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 v2 #81

Merged
merged 4 commits into from
Jul 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions cloudflare/resource_cloudflare_page_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ func resourceCloudFlarePageRule() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{"on", "off"}, false),
},

"mirage": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"on", "off"}, false),
},

"polish": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -193,6 +199,12 @@ func resourceCloudFlarePageRule() *schema.Resource {
Optional: true,
},

"disable_railgun": {
Type: schema.TypeBool,
Default: false,
Optional: true,
},

"disable_security": {
Type: schema.TypeBool,
Default: false,
Expand Down Expand Up @@ -249,7 +261,7 @@ func resourceCloudFlarePageRule() *schema.Resource {
"security_level": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"essentially_off", "low", "medium", "high", "under_attack"}, false),
ValidateFunc: validation.StringInSlice([]string{"off", "essentially_off", "low", "medium", "high", "under_attack"}, false),
},

"ssl": {
Expand Down Expand Up @@ -485,6 +497,7 @@ var pageRuleAPIOnOffFields = []string{
"explicit_cache_control",
"host_header_override",
"ip_geolocation",
"mirage",
"opportunistic_encryption",
"origin_error_page_pass_thru",
"polish",
Expand All @@ -495,9 +508,9 @@ var pageRuleAPIOnOffFields = []string{
"sort_query_string_for_cache",
"true_client_ip_header",
}
var pageRuleAPINilFields = []string{"always_use_https", "disable_apps", "disable_performance", "disable_security"}
var pageRuleAPINilFields = []string{"always_use_https", "disable_apps", "disable_performance", "disable_railgun", "disable_security"}
var pageRuleAPIFloatFields = []string{"browser_cache_ttl", "edge_cache_ttl"}
var pageRuleAPIStringFields = []string{"cache_level", "rocket_loader", "security_level", "ssl"}
var pageRuleAPIStringFields = []string{"cache_key", "cache_level", "rocket_loader", "security_level", "ssl"}

func transformFromCloudFlarePageRuleAction(pageRuleAction *cloudflare.PageRuleAction) (key string, value interface{}, err error) {
key = pageRuleAction.ID
Expand Down
4 changes: 3 additions & 1 deletion website/docs/r/page_rule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,21 @@ Action blocks support the following:
* `browser_check` - (Optional) Whether this action is `"on"` or `"off"`.
* `email_obfuscation` - (Optional) Whether this action is `"on"` or `"off"`.
* `ip_geolocation` - (Optional) Whether this action is `"on"` or `"off"`.
* `mirage` - (Optional) Whether this action is `"on"` or `"off"`.
* `opportunistic_encryption` - (Optional) Whether this action is `"on"` or `"off"`.
* `server_side_exclude` - (Optional) Whether this action is `"on"` or `"off"`.
* `smart_errors` - (Optional) Whether this action is `"on"` or `"off"`.
* `always_use_https` - (Optional) Boolean of whether this action is enabled. Default: false.
* `disable_apps` - (Optional) Boolean of whether this action is enabled. Default: false.
* `disable_performance` - (Optional) Boolean of whether this action is enabled. Default: false.
* `disable_railgun` - (Optional) Boolean of whether this action is enabled. Default: false.
* `disable_security` - (Optional) Boolean of whether this action is enabled. Default: false.
* `browser_cache_ttl` - (Optional) The Time To Live for the browser cache.
* `edge_cache_ttl` - (Optional) The Time To Live for the edge cache.
* `cache_level` - (Optional) Whether to set the cache level to `"byypass"`, `"basic"`, `"simplified"`, `"aggressive"`, or `"cache_everything"`.
* `forwarding_url` - (Optional) The URL to forward to, and with what status. See below.
* `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"`.
* `ssl` - (Optional) Whether to set the SSL mode to `"off"`, `"flexible"`, `"full"`, or `"strict"`.

Forwarding URL actions support the following:
Expand Down