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 additions #68

Closed
wants to merge 31 commits into from

Conversation

simpsora
Copy link
Contributor

This PR adds a new page rule action and adds a new value to an existing action.

It is based on unmerged upstream PR terraform-providers#61, so currently includes the changes from that PR as well.

  • Adds action explicit_cache_control action
  • Adds missing off value to security_level action

I've been using this code for the past couple of days and it's working as expected -- I can successfully enable the explicit_cache_control action and set security_level to off via Terraform, and see the results reflected in the Page Rules UI.

Note: I haven't written any tests because the existing test suite doesn't test each action and value. Happy to add tests that exercise the new functionality if you'd prefer.

Thanks for your consideration!
Ross

SteveGoldthorpe-Work and others added 27 commits May 15, 2018 15:53
…le-resolve_override

add resolve_override page_rule action
…le-resolve_override

add doc for resolve_override
…le-host_header_override

add host_header_override page_rule action
…le-host_header_override

missing bracket after merge conflict
…le-bypass_cache_on_cookie

Add page rule bypass cache on cookie
…le-disabled

page_rules status is active or disabled not paused
…ule-waf

add doc for waf page rule keyword
Add `explicit_cache_control` (called "Origin Cache Control" in the UI).
We set `security_level` to `off` in some of our page rules, but this
provider doesn't support that value.  The underlying API does, however,
so add it as a valid value.
@jacobbednarz
Copy link
Member

@simpsora For the purpose of reviewing, would it be possible to exclude the changes from #61?

@@ -59,7 +59,7 @@ Action blocks support the following:
* `host_header_override` - (Optional) The Host Header to override on the origin servers.
* `resolve_override` - (Optional) Override the origin server with this host.
* `rocket_loader` - (Optional) Whether to set the rocket loader to `"off"`, `"manual"`, or `"automatic"`.
* `security_level` - (Optional) Whether to set the security level to `"essentially_off"`, `"low"`, `"medium"`, `"high"`, or `"under_attack"`.
* `security_level` - (Optional) Whether to set the security level to `"off"`, `"essentially_off"`, `"low"`, `"medium"`, `"high"`, or `"under_attack"`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"off" is an enterprise only feature - do we need to make note of this somewhere? Or just rely on the API to return sane error messages if it isn't available?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's the responsibility of the provider to know or care about a customer's contract type with Cloudflare. The API should just To The Right Thing ™️ if a user without appropriate permissions tries to use it.

This is an enterprise-only feature, but as mentioned in this PR's
comments, I don't think that's a concern of this provider.
@simpsora simpsora mentioned this pull request Jul 5, 2018
@simpsora
Copy link
Contributor Author

simpsora commented Jul 5, 2018

Closing in favor of https://github.com/terraform-providers/terraform-provider-cloudflare/pull/81, which is based on current master and has far fewer changes.

@simpsora simpsora closed this Jul 5, 2018
@simpsora simpsora deleted the envato-page-rule-additions branch July 5, 2018 04:43
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 this pull request may close these issues.

5 participants