-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #546 from cloudflare/allow-empty-rewrite-rules-to-…
…generate cmd/generate: Handle rewriting `uri.query.value` to empty strings
- Loading branch information
Showing
15 changed files
with
177 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
testdata/cloudflare/cloudflare_ruleset_zone_rewrite_to_empty_query_parameter.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
version: 1 | ||
interactions: | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
url: https://api.cloudflare.com/client/v4/zones/0da42c8d2132a9ddaf714f9e7c920711/rulesets | ||
method: GET | ||
response: | ||
body: | | ||
{ | ||
"result": [ | ||
{ | ||
"id": "c0e45d27315a4fa2bf62ffa2312f935b", | ||
"name": "default", | ||
"description": "", | ||
"kind": "zone", | ||
"version": "5", | ||
"last_updated": "2023-02-16T00:26:08.978517Z", | ||
"phase": "http_request_transform" | ||
} | ||
], | ||
"success": true, | ||
"errors": [], | ||
"messages": [] | ||
} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
Vary: | ||
- Accept-Encoding | ||
status: 200 OK | ||
code: 200 | ||
duration: "" | ||
- request: | ||
body: "" | ||
form: {} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
url: https://api.cloudflare.com/client/v4/zones/0da42c8d2132a9ddaf714f9e7c920711/rulesets/c0e45d27315a4fa2bf62ffa2312f935b | ||
method: GET | ||
response: | ||
body: | | ||
{ | ||
"result": { | ||
"id": "c0e45d27315a4fa2bf62ffa2312f935b", | ||
"name": "default", | ||
"description": "", | ||
"kind": "zone", | ||
"version": "5", | ||
"rules": [ | ||
{ | ||
"id": "1fb6a3117e864d46bcda192d14a1e1dc", | ||
"version": "5", | ||
"action": "rewrite", | ||
"expression": "true", | ||
"description": "rewrite with no query string", | ||
"last_updated": "2023-02-16T00:26:08.978517Z", | ||
"ref": "1fb6a3117e864d46bcda192d14a1e1dc", | ||
"enabled": true, | ||
"action_parameters": { | ||
"uri": { | ||
"query": { | ||
"value": "" | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"last_updated": "2023-02-16T00:26:08.978517Z", | ||
"phase": "http_request_transform" | ||
}, | ||
"success": true, | ||
"errors": [], | ||
"messages": [] | ||
} | ||
headers: | ||
Content-Type: | ||
- application/json | ||
Vary: | ||
- Accept-Encoding | ||
status: 200 OK | ||
code: 200 | ||
duration: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
testdata/terraform/cloudflare_ruleset_zone_rewrite_to_empty_query_parameter/provider.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
terraform { | ||
required_providers { | ||
cloudflare = { | ||
source = "cloudflare/cloudflare" | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
testdata/terraform/cloudflare_ruleset_zone_rewrite_to_empty_query_parameter/test.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
resource "cloudflare_ruleset" "terraform_managed_resource" { | ||
kind = "zone" | ||
name = "default" | ||
phase = "http_request_transform" | ||
zone_id = "0da42c8d2132a9ddaf714f9e7c920711" | ||
rules { | ||
action = "rewrite" | ||
action_parameters { | ||
uri { | ||
query { | ||
value = "" | ||
} | ||
} | ||
} | ||
description = "rewrite with no query string" | ||
enabled = true | ||
expression = "true" | ||
id = "1fb6a3117e864d46bcda192d14a1e1dc" | ||
last_updated = "2023-02-16T00:26:08.978517Z" | ||
ref = "1fb6a3117e864d46bcda192d14a1e1dc" | ||
version = "5" | ||
} | ||
} |