Skip to content

Commit

Permalink
Update to TF-1.3 (#6)
Browse files Browse the repository at this point in the history
* Update to TF-1.3

* Update CI
  • Loading branch information
snovikov authored Feb 3, 2023
1 parent 7704380 commit 9834e31
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 111 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/backups.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
---

name: Backup Github Respository

# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
name: Backup Repository

on:
push:
Expand All @@ -13,11 +8,10 @@ on:

jobs:
backup:
uses: Flaconi/github-reusable-workflow/.github/workflows/backups.yml@stable
uses: Flaconi/github-reusable-workflow/.github/workflows/backups.yml@v1
with:
enabled: True
region: eu-central-1
secrets:
iam_role_arn: ${{ secrets.BACKUP_REPO_IAM_ROLE }}
bucket_name: ${{ secrets.BACKUP_REPO_BUCKET }}
git_read_token: ${{ secrets.REPO_READ_TOKEN }}
6 changes: 5 additions & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
---
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master

permissions:
contents: write
pull-requests: write

jobs:
update_release_draft:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TF_MODULES = $(sort $(dir $(wildcard $(CURRENT_DIR)modules/*/)))
# -------------------------------------------------------------------------------------------------
# Container versions
# -------------------------------------------------------------------------------------------------
TF_VERSION = 1.0.11
TF_VERSION = 1.3.7
TFDOCS_VERSION = 0.16.0-0.31
FL_VERSION = 0.4
JL_VERSION = 1.6.0-0.5
Expand Down
51 changes: 26 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ page_rules = [

| Name | Version |
|------|---------|
| <a name="provider_cloudflare"></a> [cloudflare](#provider\_cloudflare) | ~> 3.21 |
| <a name="provider_cloudflare"></a> [cloudflare](#provider\_cloudflare) | ~> 3.33 |

<!-- TFDOCS_PROVIDER_END -->

Expand All @@ -56,8 +56,8 @@ page_rules = [

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 |
| <a name="requirement_cloudflare"></a> [cloudflare](#requirement\_cloudflare) | ~> 3.21 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.3 |
| <a name="requirement_cloudflare"></a> [cloudflare](#requirement\_cloudflare) | ~> 3.33 |

<!-- TFDOCS_REQUIREMENTS_END -->

Expand Down Expand Up @@ -91,13 +91,14 @@ Type:
```hcl
list(object({
target = string
status = string
status = optional(string, "active")
actions = object({
always_use_https = optional(bool)
disable_apps = optional(bool)
disable_performance = optional(bool)
disable_railgun = optional(bool)
disable_security = optional(bool)
always_use_https = optional(bool, false)
disable_apps = optional(bool, false)
disable_performance = optional(bool, false)
disable_railgun = optional(bool, false)
disable_security = optional(bool, false)
disable_zaraz = optional(bool, false)
edge_cache_ttl = optional(number)
automatic_https_rewrites = optional(string)
browser_cache_ttl = optional(number)
Expand All @@ -109,43 +110,43 @@ list(object({
cache_key_fields = optional(list(object({
query_string = object({
exclude = optional(list(string))
include = optional(list(string))
ignore = optional(bool)
exclude = optional(list(string), [])
include = optional(list(string), [])
ignore = optional(bool, false)
})
header = object({
exclude = optional(list(string))
include = optional(list(string))
check_presence = optional(list(string))
exclude = optional(list(string), [])
include = optional(list(string), [])
check_presence = optional(list(string), [])
})
cookie = object({
include = optional(list(string))
check_presence = optional(list(string))
include = optional(list(string), [])
check_presence = optional(list(string), [])
})
host = object({
resolved = string
resolved = optional(bool, false)
})
user = object({
lang = string
device_type = string
geo = string
lang = optional(bool, false)
device_type = optional(bool, false)
geo = optional(bool, false)
})
})))
})), [])
cache_level = optional(string)
cache_ttl_by_status = optional(list(object({
codes = string
ttl = number
})))
})), [])
email_obfuscation = optional(string)
explicit_cache_control = optional(string)
forwarding_url = optional(list(object({
status_code = string
url = string
})))
})), [])
host_header_override = optional(string)
ip_geolocation = optional(string)
Expand All @@ -154,7 +155,7 @@ list(object({
html = string
css = string
js = string
})))
})), [])
mirage = optional(string)
opportunistic_encryption = optional(string)
Expand Down
101 changes: 51 additions & 50 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,93 +9,94 @@ resource "cloudflare_page_rule" "page_rules" {
for_each = local.page_rules
target = each.value["target"]

priority = lookup(each.value, "priority", null)
status = lookup(each.value, "status", null)
priority = each.value["priority"]
status = each.value["status"]

actions {
always_use_https = lookup(each.value["actions"], "always_use_https", null)
disable_apps = lookup(each.value["actions"], "disable_apps", null)
disable_performance = lookup(each.value["actions"], "disable_performance", null)
disable_railgun = lookup(each.value["actions"], "disable_railgun", null)
disable_security = lookup(each.value["actions"], "disable_security", null)
edge_cache_ttl = lookup(each.value["actions"], "edge_cache_ttl", null)
automatic_https_rewrites = lookup(each.value["actions"], "automatic_https_rewrites", null)
browser_cache_ttl = lookup(each.value["actions"], "browser_cache_ttl", null)
browser_check = lookup(each.value["actions"], "browser_check", null)
bypass_cache_on_cookie = lookup(each.value["actions"], "bypass_cache_on_cookie", null)
cache_on_cookie = lookup(each.value["actions"], "cache_on_cookie", null)
cache_by_device_type = lookup(each.value["actions"], "cache_by_device_type", null)
cache_deception_armor = lookup(each.value["actions"], "cache_deception_armor", null)
always_use_https = each.value["actions"]["always_use_https"]
disable_apps = each.value["actions"]["disable_apps"]
disable_performance = each.value["actions"]["disable_performance"]
disable_railgun = each.value["actions"]["disable_railgun"]
disable_security = each.value["actions"]["disable_security"]
disable_zaraz = each.value["actions"]["disable_zaraz"]
edge_cache_ttl = each.value["actions"]["edge_cache_ttl"]
automatic_https_rewrites = each.value["actions"]["automatic_https_rewrites"]
browser_cache_ttl = each.value["actions"]["browser_cache_ttl"]
browser_check = each.value["actions"]["browser_check"]
bypass_cache_on_cookie = each.value["actions"]["bypass_cache_on_cookie"]
cache_on_cookie = each.value["actions"]["cache_on_cookie"]
cache_by_device_type = each.value["actions"]["cache_by_device_type"]
cache_deception_armor = each.value["actions"]["cache_deception_armor"]

dynamic "cache_key_fields" {
for_each = each.value["actions"]["cache_key_fields"] != null ? each.value["actions"]["cache_key_fields"] : []
for_each = each.value["actions"]["cache_key_fields"]
content {
query_string {
exclude = contains(keys(cache_key_fields.value), "query_string") ? lookup(cache_key_fields.value["query_string"], "exclude", []) : []
include = contains(keys(cache_key_fields.value), "query_string") ? lookup(cache_key_fields.value["query_string"], "include", []) : []
ignore = contains(keys(cache_key_fields.value), "query_string") ? lookup(cache_key_fields.value["query_string"], "ignore", null) : null
exclude = cache_key_fields.value["query_string"]["exclude"]
include = cache_key_fields.value["query_string"]["include"]
ignore = cache_key_fields.value["query_string"]["ignore"]
}
header {
exclude = contains(keys(cache_key_fields.value), "header") ? lookup(cache_key_fields.value["header"], "exclude", []) : []
include = contains(keys(cache_key_fields.value), "header") ? lookup(cache_key_fields.value["header"], "include", []) : []
check_presence = contains(keys(cache_key_fields.value), "header") ? lookup(cache_key_fields.value["header"], "check_presence", []) : []
exclude = cache_key_fields.value["header"]["exclude"]
include = cache_key_fields.value["header"]["include"]
check_presence = cache_key_fields.value["header"]["check_presence"]
}
cookie {
check_presence = contains(keys(cache_key_fields.value), "cookie") ? lookup(cache_key_fields.value["cookie"], "check_presence", []) : []
include = contains(keys(cache_key_fields.value), "cookie") ? lookup(cache_key_fields.value["cookie"], "include", []) : []
check_presence = cache_key_fields.value["cookie"]["check_presence"]
include = cache_key_fields.value["cookie"]["include"]
}
host {
resolved = contains(keys(cache_key_fields.value), "host") ? lookup(cache_key_fields.value["host"], "resolved", null) : null
resolved = cache_key_fields.value["host"]["resolved"]
}
user {
lang = contains(keys(cache_key_fields.value), "user") ? lookup(cache_key_fields.value["user"], "lang", null) : null
device_type = contains(keys(cache_key_fields.value), "user") ? lookup(cache_key_fields.value["user"], "device_type", null) : null
geo = contains(keys(cache_key_fields.value), "user") ? lookup(cache_key_fields.value["user"], "geo", null) : null
lang = cache_key_fields.value["user"]["lang"]
device_type = cache_key_fields.value["user"]["device_type"]
geo = cache_key_fields.value["user"]["geo"]
}
}
}

cache_level = lookup(each.value["actions"], "cache_level", null)
cache_level = each.value["actions"]["cache_level"]

dynamic "cache_ttl_by_status" {
for_each = each.value["actions"]["cache_ttl_by_status"] != null ? each.value["actions"]["cache_ttl_by_status"] : []
for_each = each.value["actions"]["cache_ttl_by_status"]
content {
codes = cache_ttl_by_status.value["codes"]
ttl = cache_ttl_by_status.value["ttl"]
}
}
email_obfuscation = lookup(each.value["actions"], "email_obfuscation", null)
explicit_cache_control = lookup(each.value["actions"], "explicit_cache_control", null)
email_obfuscation = each.value["actions"]["email_obfuscation"]
explicit_cache_control = each.value["actions"]["explicit_cache_control"]
dynamic "forwarding_url" {
for_each = each.value["actions"]["forwarding_url"] != null ? each.value["actions"]["forwarding_url"] : []
for_each = each.value["actions"]["forwarding_url"]
content {
status_code = forwarding_url.value["status_code"]
url = forwarding_url.value["url"]
}
}
host_header_override = lookup(each.value["actions"], "host_header_override", null)
ip_geolocation = lookup(each.value["actions"], "ip_geolocation", null)
host_header_override = each.value["actions"]["host_header_override"]
ip_geolocation = each.value["actions"]["ip_geolocation"]
dynamic "minify" {
for_each = each.value["actions"]["minify"] != null ? each.value["actions"]["minify"] : []
for_each = each.value["actions"]["minify"]
content {
html = minify.value["html"]
css = minify.value["css"]
js = minify.value["js"]
}
}
mirage = lookup(each.value["actions"], "mirage", null)
opportunistic_encryption = lookup(each.value["actions"], "opportunistic_encryption", null)
origin_error_page_pass_thru = lookup(each.value["actions"], "origin_error_page_pass_thru", null)
polish = lookup(each.value["actions"], "polish", null)
resolve_override = lookup(each.value["actions"], "resolve_override", null)
respect_strong_etag = lookup(each.value["actions"], "respect_strong_etag", null)
response_buffering = lookup(each.value["actions"], "response_buffering", null)
rocket_loader = lookup(each.value["actions"], "rocket_loader", null)
security_level = lookup(each.value["actions"], "security_level", null)
server_side_exclude = lookup(each.value["actions"], "server_side_exclude", null)
sort_query_string_for_cache = lookup(each.value["actions"], "sort_query_string_for_cache", null)
ssl = lookup(each.value["actions"], "ssl", null)
true_client_ip_header = lookup(each.value["actions"], "true_client_ip_header", null)
waf = lookup(each.value["actions"], "waf", null)
mirage = each.value["actions"]["mirage"]
opportunistic_encryption = each.value["actions"]["opportunistic_encryption"]
origin_error_page_pass_thru = each.value["actions"]["origin_error_page_pass_thru"]
polish = each.value["actions"]["polish"]
resolve_override = each.value["actions"]["resolve_override"]
respect_strong_etag = each.value["actions"]["respect_strong_etag"]
response_buffering = each.value["actions"]["response_buffering"]
rocket_loader = each.value["actions"]["rocket_loader"]
security_level = each.value["actions"]["security_level"]
server_side_exclude = each.value["actions"]["server_side_exclude"]
sort_query_string_for_cache = each.value["actions"]["sort_query_string_for_cache"]
ssl = each.value["actions"]["ssl"]
true_client_ip_header = each.value["actions"]["true_client_ip_header"]
waf = each.value["actions"]["waf"]
}
}
45 changes: 23 additions & 22 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ variable "page_rules" {
description = "List of Cloudflare page rule objects."
type = list(object({
target = string
status = string
status = optional(string, "active")
actions = object({
always_use_https = optional(bool)
disable_apps = optional(bool)
disable_performance = optional(bool)
disable_railgun = optional(bool)
disable_security = optional(bool)
always_use_https = optional(bool, false)
disable_apps = optional(bool, false)
disable_performance = optional(bool, false)
disable_railgun = optional(bool, false)
disable_security = optional(bool, false)
disable_zaraz = optional(bool, false)
edge_cache_ttl = optional(number)
automatic_https_rewrites = optional(string)
browser_cache_ttl = optional(number)
Expand All @@ -28,43 +29,43 @@ variable "page_rules" {

cache_key_fields = optional(list(object({
query_string = object({
exclude = optional(list(string))
include = optional(list(string))
ignore = optional(bool)
exclude = optional(list(string), [])
include = optional(list(string), [])
ignore = optional(bool, false)
})
header = object({
exclude = optional(list(string))
include = optional(list(string))
check_presence = optional(list(string))
exclude = optional(list(string), [])
include = optional(list(string), [])
check_presence = optional(list(string), [])
})
cookie = object({
include = optional(list(string))
check_presence = optional(list(string))
include = optional(list(string), [])
check_presence = optional(list(string), [])
})
host = object({
resolved = string
resolved = optional(bool, false)
})
user = object({
lang = string
device_type = string
geo = string
lang = optional(bool, false)
device_type = optional(bool, false)
geo = optional(bool, false)
})
})))
})), [])

cache_level = optional(string)

cache_ttl_by_status = optional(list(object({
codes = string
ttl = number
})))
})), [])

email_obfuscation = optional(string)
explicit_cache_control = optional(string)

forwarding_url = optional(list(object({
status_code = string
url = string
})))
})), [])

host_header_override = optional(string)
ip_geolocation = optional(string)
Expand All @@ -73,7 +74,7 @@ variable "page_rules" {
html = string
css = string
js = string
})))
})), [])

mirage = optional(string)
opportunistic_encryption = optional(string)
Expand Down
Loading

0 comments on commit 9834e31

Please sign in to comment.