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

Page rule status options are invalid/broken #94

Closed
chdsbd opened this issue Jul 15, 2018 · 2 comments
Closed

Page rule status options are invalid/broken #94

chdsbd opened this issue Jul 15, 2018 · 2 comments

Comments

@chdsbd
Copy link
Contributor

chdsbd commented Jul 15, 2018

Terraform Version

❯ terraform --version
Terraform v0.11.7
+ provider.cloudflare v1.0.0

Affected Resource(s)

  • cloudflare_page_rule

Terraform Configuration Files

resource "cloudflare_page_rule" "some_rule" {
  zone = "${var.domain}"
  target = "${var.domain}/blah"
  priority = 1
  status = "deactivated"

  actions = {
    forwarding_url {
      url = "https://www.example.com/"
      status_code = 301
    }
  }
}

Debug Output

❯ terraform plan

Error: cloudflare_page_rule.some_rule: expected status to be one of [active paused], got deactivated

Expected Behavior

Terraform should not error on valid status.

Actual Behavior

Terraform plan errors on status that is not active or paused. The real problem here is that while paused will work for terraform plan, it is not valid for the Cloudflare API.

The valid page rules status options for the Cloudflare api are: active and disabled. This Cloudflare Terraform provider erroneously requires the status to be one of active or paused.

relevant docs: https://api.cloudflare.com/#page-rules-for-a-zone-create-page-rule

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan with deactivated as a status value

alternatively to trigger api error when applying

  1. terraform plan with paused as a status value
  2. terraform apply

References

Here is the code that needs a patch

https://github.com/terraform-providers/terraform-provider-cloudflare/blob/cedda3010a6ba474a3b2287cd932cf27a8273880/cloudflare/resource_cloudflare_page_rule.go#L288

@patryk
Copy link
Contributor

patryk commented Jul 16, 2018

I'm sorry you're having problems, but the correct value is disabled. We've already fixed it in #84, waiting now for Terraform to release new version. In the meantime you may use a cloned master branch or import a patch.

@patryk patryk closed this as completed Jul 16, 2018
@chdsbd
Copy link
Contributor Author

chdsbd commented Jul 16, 2018

Oh, lol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants