Skip to content

Commit

Permalink
fix handling of excluding all query string parameters from page rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz committed Jun 22, 2023
1 parent b3bd601 commit 85a4666
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/app/cf-terraforming/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ func generateResources() func(cmd *cobra.Command, args []string) {
// Remap cache_key_fields.query_string.include & .exclude wildcards (not in an array) to the appropriate "ignore" field value in Terraform.
if c, ok := jsonStructData[i].(map[string]interface{})["actions"].(map[string]interface{})["cache_key_fields"].(map[string]interface{}); ok {
if s, sok := c["query_string"].(map[string]interface{})["include"].(string); sok && s == "*" {
jsonStructData[i].(map[string]interface{})["actions"].(map[string]interface{})["cache_key_fields"].(map[string]interface{})["query_string"].(map[string]interface{})["include"] = []interface{}{}
jsonStructData[i].(map[string]interface{})["actions"].(map[string]interface{})["cache_key_fields"].(map[string]interface{})["query_string"].(map[string]interface{})["include"] = nil
jsonStructData[i].(map[string]interface{})["actions"].(map[string]interface{})["cache_key_fields"].(map[string]interface{})["query_string"].(map[string]interface{})["ignore"] = false
}
if s, sok := c["query_string"].(map[string]interface{})["exclude"].(string); sok && s == "*" {
Expand Down
4 changes: 1 addition & 3 deletions testdata/cloudflare/cloudflare_page_rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ interactions:
},
"query_string": {
"include": [],
"exclude": [
"*"
]
"exclude": "*"
},
"host": {
"resolved": true
Expand Down

0 comments on commit 85a4666

Please sign in to comment.