Skip to content

Commit

Permalink
drop cache_ttl_by_status grit due to complexity. Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Fowler committed Dec 18, 2024
1 parent 715b8fa commit 893c3c4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,12 @@ pattern cloudflare_terraform_v5_attribute_renames_config() {
`default_pool_ids = $v` as $attribute => `default_pools = $v` where { $attribute <: within `resource "cloudflare_load_balancer" $_ { $_ }` },

// cloudflare_page_rule
`ignore = true` as $attribute => `exclude = ["*"]` where and { $attribute <: within `resource "cloudflare_page_rule" $_ { $_ }`, $attribute <: within `cache_key_fields { $_ }`, $attribute <: within `query_string { $_ }` },
`ignore = false` as $attribute => `include = ["*"]` where and { $attribute <: within `resource "cloudflare_page_rule" $_ { $_ }`, $attribute <: within `cache_key_fields { $_ }`, $attribute <: within `query_string { $_ }` },
`resource "cloudflare_page_rule" $_ { $body }` where {
$body <: contains `actions = [ $actions ]` where {
$actions <: contains `$cttl` where {
$cttl <: contains `cache_ttl_by_status = $cttl_ele` where {
$cttl_ele <: contains `[ $old ]` where {
$old <: some bubble `$ele` where {
$ele <: contains `codes = $code` => . ,
$ele <: contains `ttl = $ttl` => .,
$ele => `$code => $ttl`,
}
},
$cttl_ele <: contains `,` =>.
},
},
$body <: contains `cache_key_fields = $ckf` where {
$ckf <: contains `query_string = $qs` where and {
$qs <: contains `ignore = false` => `include = ["*"]`,
$qs <: contains `ignore = true` => `exclude = ["*"]`,
}
}
},

Expand Down
56 changes: 19 additions & 37 deletions templates/guides/version-5-upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -1244,40 +1244,23 @@ resource "cloudflare_api_token" "example" {

## cloudflare_page_rule

- ``
- `ignore = true` is now `exclude = ["*"]`
- `ignore = false` is now `include = ["*"]`
- `cache_ttl_by_status` is now a map (`cache_ttl_by_status = { ... }`) instead of a list of objects (`cache_ttl_by_status = [{ ... }]`)

Before

```
resource "cloudflare_page_rule" "example" {
target = "example.com"
actions = [
{
cache_ttl_by_status = [
{
codes = "200-299"
ttl = 300
},
{
codes = "300-399"
ttl = 60
},
{
codes = "400-403"
ttl = -1
},
{
codes = "404"
ttl = 30
},
{
codes = "405-499"
ttl = -1
},
{
codes = "500-599"
ttl = 0
cache_key_fields = {
query_string = {
ignore = true
ignore = false
}
]
}
}
]
}
Expand All @@ -1287,18 +1270,17 @@ After

```
resource "cloudflare_page_rule" "example" {
actions = {
cache_ttl_by_status = {
"100-149" = "no-cache"
"150-199" = "no-store"
"200-299" = 300
"300-399" = 60
"400-403" = -1
"404" = 30
"405-499" = -1
"500-599" = 0
target = "example.com"
actions = [
{
cache_key_fields = {
query_string = {
exclude = ["*"]
include = ["*"]
}
}
}
}
]
}
```

Expand Down

0 comments on commit 893c3c4

Please sign in to comment.