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

"Invalid setting bypass_cache_on_cookie" for cloudflare_page_rule #2839

Closed
2 tasks done
perfectra1n opened this issue Oct 12, 2023 · 3 comments
Closed
2 tasks done

"Invalid setting bypass_cache_on_cookie" for cloudflare_page_rule #2839

perfectra1n opened this issue Oct 12, 2023 · 3 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@perfectra1n
Copy link

perfectra1n commented Oct 12, 2023

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

Terraform: v1.6.1
Cloudflare: v4.16.0

Affected resource(s)

cloudflare_page_rule.actions.bypass_cache_on_cookie

Terraform configuration files

resource "cloudflare_page_rule" "cache_everything1" {
  zone_id = var.zone_id
  target = "www.website.com/*"
  priority = 1
  status = "active"

  actions {
    cache_level = "cache_everything"
    bypass_cache_on_cookie = "wordpress_*"
    edge_cache_ttl = 7200
  }
}

Link to debug output

???

Panic output

No response

Expected output

bypass_cache_on_cookie action would work.

Actual output

I could be losing my mind, but it looks like bypass_cache_on_cookie isn't valid, even though it's documented here.

2023-10-11T17:06:50.312-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: 2023/10/11 17:06:50 [DEBUG] Cloudflare Page Rule update configuration: cloudflare.PageRule{ID:"", Targets:[]cloudflare.PageRuleTarget{cloudflare.PageRuleTarget{Target:"url", Constraint:struct { Operator string "json:\"operator\""; Value string "json:\"value\"" }{Operator:"matches", Value:"www.website.com/*"}}}, Actions:[]cloudflare.PageRuleAction{cloudflare.PageRuleAction{ID:"bypass_cache_on_cookie", Value:"asdf"}, cloudflare.PageRuleAction{ID:"edge_cache_ttl", Value:7200}, cloudflare.PageRuleAction{ID:"cache_level", Value:"cache_everything"}}, Priority:1, Status:"active", ModifiedOn:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), CreatedOn:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC)}
2023-10-11T17:06:50.312-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: 2023/10/11 17:06:50
2023-10-11T17:06:50.312-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: PUT /client/v4/zones/zoneid/pagerules/ruleid HTTP/1.1
2023-10-11T17:06:50.312-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Host: api.cloudflare.com
2023-10-11T17:06:50.312-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: User-Agent: terraform/1.6.1 terraform-plugin-sdk/2.10.1 terraform-provider-cloudflare/4.16.0
2023-10-11T17:06:50.312-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Content-Length: 348
2023-10-11T17:06:50.312-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Content-Type: application/json
2023-10-11T17:06:50.312-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: X-Auth-Email: [redacted]
2023-10-11T17:06:50.312-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: X-Auth-Key: [redacted]
2023-10-11T17:06:50.312-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Accept-Encoding: gzip
2023-10-11T17:06:50.312-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0
2023-10-11T17:06:50.312-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: {"targets":[{"target":"url","constraint":{"operator":"matches","value":"www.atviksecurity.com/*"}}],"actions":[{"id":"bypass_cache_on_cookie","value":"asdf"},{"id":"edge_cache_ttl","value":7200},{"id":"cache_level","value":"cache_everything"}],"priority":1,"status":"active","modified_on":"0001-01-01T00:00:00Z","created_on":"0001-01-01T00:00:00Z"}
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: 2023/10/11 17:06:50
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: HTTP/2.0 400 Bad Request
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Connection: close
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Cf-Cache-Status: DYNAMIC
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Cf-Ray: 814b19679a9f966f-SJC
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Content-Type: application/json
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Date: Thu, 12 Oct 2023 00:06:50 GMT
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Expires: Sun, 25 Jan 1981 05:00:00 GMT
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Pragma: no-cache
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Server: cloudflare
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Set-Cookie: __cflb=0H28vgHxwvgAQtjUGUFqYFDiSDreGJnUufHUbPk4Y9s; SameSite=Lax; path=/; expires=Thu, 12-Oct-23 02:36:51 GMT; HttpOnly
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Set-Cookie: __cfruid=0011d800075b724b10ecdcf665fa520a2fd650ce-1697069210; path=/; domain=.api.cloudflare.com; HttpOnly; Secure; SameSite=None
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Strict-Transport-Security: max-age=31536000
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: Vary: Accept-Encoding
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: X-Content-Type-Options: nosniff
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: X-Frame-Options: SAMEORIGIN
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0
2023-10-11T17:06:50.517-0700 [DEBUG] provider.terraform-provider-cloudflare_v4.16.0: {"success":false,"errors":[{"code":1004,"message":"Page Rule validation failed: See messages for details."}],"messages":[{"code":1,"message":".settings[0]: Invalid setting bypass_cache_on_cookie","type":null}],"result":null}
Error: failed to update Cloudflare Page Rule: Page Rule validation failed: See messages for details. (1004)
.settings[2]: Invalid setting bypass_cache_on_cookie

  with module.atvik_caching.cloudflare_page_rule.cache_everything1,
  on caching/main.tf line 25, in resource "cloudflare_page_rule" "cache_everything1":
  25: resource "cloudflare_page_rule" "cache_everything1" {

Steps to reproduce

  1. Create resource with the following data:
resource "cloudflare_page_rule" "cache_everything1" {
  zone_id = var.zone_id
  target = "asdf.com/*"
  priority = 2
  status = "active"

  actions {
    cache_level = "cache_everything"
    bypass_cache_on_cookie = "asdf"
    edge_cache_ttl = 7200
  }
}
  1. Hit terraform apply and approve it
  2. Watch the errors flow in

Additional factoids

No response

References

No response

@perfectra1n perfectra1n added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 12, 2023
@github-actions
Copy link
Contributor

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions
Copy link
Contributor

Thank you for reporting this issue! For maintainers to dig into issues it is required that all issues include the entirety of TF_LOG=DEBUG output to be provided. The only parts that should be redacted are your user credentials in the X-Auth-Key, X-Auth-Email and Authorization HTTP headers. Details such as zone or account identifiers are not considered sensitive but can be redacted if you are very cautious. This log file provides additional context from Terraform, the provider and the Cloudflare API that helps in debugging issues. Without it, maintainers are very limited in what they can do and may hamper diagnosis efforts.

This issue has been marked with triage/needs-information and is unlikely to receive maintainer attention until the log file is provided making this a complete bug report.

@github-actions github-actions bot added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 12, 2023
@perfectra1n
Copy link
Author

Ahhhh STUPID Cloudflare. It's only for Business or Enterprise plans....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

1 participant