Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Partner rate_plan #1307

Closed
ledzepp4eva opened this issue Nov 11, 2021 · 7 comments · Fixed by #1464
Closed

Support Partner rate_plan #1307

ledzepp4eva opened this issue Nov 11, 2021 · 7 comments · Fixed by #1464
Labels
kind/enhancement Categorizes issue or PR as related to improving an existing feature. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@ledzepp4eva
Copy link

ledzepp4eva commented Nov 11, 2021

Current Terraform and Cloudflare provider version

$ terraform -v
Terraform v1.0.11
on linux_amd64

Description

Currently there are options to set the rate_plan on the zone settings via plan, however this only supports CF_* It would be good for use with Tenant API to add support for PARTNERS_*.

Use cases

As a user of Tenant API on Cloudflare I want to be able to configure our zones rate_plan via terraform, however we can't mimic the behaviour:
curl -sX POST https://api.cloudflare.com/client/v4/zones/${cf_zone_id}/subscription -H "Content-Type: application/json" -H "x-auth-email: ${cf_global_auth_email}" -H "x-auth-key: ${cf_global_api_key}" -d '{ "rate_plan": {"id": "PARTNERS_PRO"}}'

However using the plan option attempts to set CF_PRO and returns the error:

│ Error: error setting plan pro for zone "12345": HTTP status 400: failed to resolve provided rate plan: 'CF_PRO' (1204) 
with cloudflare_zone.redirect_zone["example.org"],
on main.tf line 19, in resource "cloudflare_zone" "redirect_zone":
19: resource "cloudflare_zone" "redirect_zone" {

This is using the Cloudflare resource cloudflare_zone

resource "cloudflare_zone" "redirect_zone" {
  for_each = var.zones
  zone     = each.value.zone
  type     = each.value.dns
  plan     = each.value.plan
}

Potential Terraform configuration

zones = {
  "example.org" = {
    zone = "example.org",
    dns  = "full",
    ssl  = "full",
    plan = "pro",
    partners = true,
    value_records = {},
    data_records = {},
    page_rules = {}
  },
}

or

zones = {
  "example.org" = {
    zone = "example.org",
    dns  = "full",
    ssl  = "full",
    plan = "cf_pro", #or "partners_pro"
    value_records = {},
    data_records = {},
    page_rules = {}
  },
}

References

No response

@ledzepp4eva ledzepp4eva added kind/enhancement Categorizes issue or PR as related to improving an existing feature. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 11, 2021
@jacobbednarz
Copy link
Member

for each of these values (pro, biz and ent) what is the "public_name" value provided in the rate plan configuration?

i don’t have access to a tenant account to confirm this so if you can provide it, we can look at adding support.

@ledzepp4eva
Copy link
Author

These are the ones that are returned from the api:

      "rate_plan": {
        "id": "partners_biz",
        "public_name": "Partners Business Plan",
        "currency": "USD",
        "scope": "zone",
        "externally_managed": false,
        "sets": [
          "zone",
          "partner"
        ],
        "is_contract": true
      },
      "rate_plan": {
        "id": "partners_free",
        "public_name": "Partners Free Plan",
        "currency": "USD",
        "scope": "zone",
        "externally_managed": false,
        "sets": [
          "zone",
          "partner"
        ],
        "is_contract": false
      },
      "rate_plan": {
        "id": "image_resizing_ent",
        "public_name": "Image Resizing Ent",
        "currency": "USD",
        "scope": "user",
        "externally_managed": false,
        "sets": [
          "usage",
          "is_cloudflare",
          "public"
        ],
        "is_contract": true
      },
      "rate_plan": {
        "id": "partners_workers_ss",
        "public_name": "Cloudflare Workers",
        "currency": "USD",
        "scope": "user",
        "externally_managed": false,
        "sets": [
          "usage",
          "partner"
        ],
        "is_contract": true
      },
      "rate_plan": {
        "id": "partners_biz",
        "public_name": "Partners Business Plan",
        "currency": "USD",
        "scope": "zone",
        "externally_managed": false,
        "sets": [
          "zone",
          "partner"
        ],
        "is_contract": true
      },
      "rate_plan": {
        "id": "partners_pro",
        "public_name": "Partners Professional Plan",
        "currency": "USD",
        "scope": "zone",
        "externally_managed": false,
        "sets": [
          "zone",
          "partner"
        ],
        "is_contract": true
      },

We've since had Cloudflare enable a couple more plans, so I've added those for completness.

@jacobbednarz
Copy link
Member

thanks, I’ll see what I can do with this.

@jacobbednarz
Copy link
Member

there should be an enterprise one as well; do you have that handy?

jacobbednarz added a commit that referenced this issue Feb 16, 2022
This is an incomplete list of partner plans but should unblock some
usage and we can extend it as needed.

Closes #1307
@jacobbednarz
Copy link
Member

took a pass at this via #1464. you'll want to pull it locally, build it and give it a whirl before it is merged to make sure it meets your needs.

jacobbednarz added a commit that referenced this issue Feb 16, 2022
This is an incomplete list of partner plans but should unblock some
usage and we can extend it as needed.

Closes #1307
@ledzepp4eva
Copy link
Author

Sorry I didn't get back to you, but I couldn't find when I was looking through the rate plans and subscriptions, which was odd. I don't think I've actually provisioned any enterprise accounts myself (other than the one Cloudflare setup initially)

I'll try and have a look at that for you today if I can.

jacobbednarz added a commit that referenced this issue Feb 16, 2022
This is an incomplete list of partner plans but should unblock some
usage and we can extend it as needed.

Closes #1307
@jacobbednarz
Copy link
Member

that's fine; i just guessed as to what it should be based on the remainder. if you give the branch a go you can see if it covers your use cases anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Categorizes issue or PR as related to improving an existing feature. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants