From 84c253c9b53abb664d8f641fede0fb6e92d79883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 22 Aug 2024 23:31:57 +0300 Subject: [PATCH 1/6] Add records_default_proxied variable --- variables.tf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/variables.tf b/variables.tf index 0ef6097..b82c1af 100644 --- a/variables.tf +++ b/variables.tf @@ -37,6 +37,12 @@ variable "records" { DOC } +variable "records_default_proxied" { + type = bool + description = "Default value for proxied" + default = false +} + variable "paused" { type = bool description = "Whether this zone is paused (traffic bypasses Cloudflare)" From 8198a1001fd397fbc2f4a24b624f5a09bf5eee1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 22 Aug 2024 23:33:09 +0300 Subject: [PATCH 2/6] Add records_default_proxied local --- main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/main.tf b/main.tf index 13684f9..c05d3f5 100644 --- a/main.tf +++ b/main.tf @@ -10,6 +10,7 @@ locals { for index, record in var.records : try(record.key, format("%s-%s-%s", record.name, record.type, record.value)) => record } : {} + records_default_proxied = var.records_default_proxied } data "cloudflare_zones" "default" { From de7d3cac9899a47c3c1292f20b37f825e8a1163e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 22 Aug 2024 23:33:35 +0300 Subject: [PATCH 3/6] Use records_default_proxied local --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index c05d3f5..1148a77 100644 --- a/main.tf +++ b/main.tf @@ -41,7 +41,7 @@ resource "cloudflare_record" "default" { value = each.value.value comment = lookup(each.value, "comment", null) priority = lookup(each.value, "priority", null) - proxied = lookup(each.value, "proxied", false) + proxied = lookup(each.value, "proxied", local.records_default_proxied) ttl = lookup(each.value, "ttl", 1) } From c66f490c9d4aecc8cfb8201bba0d805a7a7b0484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 22 Aug 2024 23:39:58 +0300 Subject: [PATCH 4/6] Update versioned dependencies in docs --- docs/terraform.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/terraform.md b/docs/terraform.md index f063a29..abbbcdd 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -11,8 +11,8 @@ | Name | Version | |------|---------| -| [cloudflare](#provider\_cloudflare) | 4.34.0 | -| [time](#provider\_time) | 0.11.2 | +| [cloudflare](#provider\_cloudflare) | >= 4.0 | +| [time](#provider\_time) | >= 0.8 | ## Modules From e22b1ca8ecdbd8a15ac32403a4c94b0f7405473a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Fri, 23 Aug 2024 02:31:29 +0300 Subject: [PATCH 5/6] Update documentation for proxied field --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index b82c1af..ad2a606 100644 --- a/variables.tf +++ b/variables.tf @@ -33,7 +33,7 @@ variable "records" { The priority of the record. proxied: Whether the record gets Cloudflare's origin protection. - Default value: false. + Default value: Taken from records_default_proxied variable DOC } From 72e8c36b662a71181bca48adecf466d628f7756b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 22 Aug 2024 23:39:36 +0300 Subject: [PATCH 6/6] Update generated documentation for input_records_default_proxied --- README.md | 3 ++- docs/terraform.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 146676d..7569830 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,8 @@ Available targets: | [page\_rules](#input\_page\_rules) | A list of maps of Page Rules.
The values of map is fully compliant with `cloudflare_page_rule` resource.
To get more info see https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/cloudflare_page_rule | `list(any)` | `null` | no | | [paused](#input\_paused) | Whether this zone is paused (traffic bypasses Cloudflare) | `bool` | `false` | no | | [plan](#input\_plan) | The name of the commercial plan to apply to the zone. Possible values: `free`, `pro`, `business`, `enterprise` | `string` | `"free"` | no | -| [records](#input\_records) | name:
The name of the record.
type:
The type of the record.
value:
The value of the record.
comment:
Optional comment for the record.
ttl:
The TTL of the record.
Default value: 1.
priority:
The priority of the record.
proxied:
Whether the record gets Cloudflare's origin protection.
Default value: false. | `list(any)` | `[]` | no | +| [records](#input\_records) | name:
The name of the record.
type:
The type of the record.
value:
The value of the record.
comment:
Optional comment for the record.
ttl:
The TTL of the record.
Default value: 1.
priority:
The priority of the record.
proxied:
Whether the record gets Cloudflare's origin protection.
Default value: Taken from records\_default\_proxied variable | `list(any)` | `[]` | no | +| [records\_default\_proxied](#input\_records\_default\_proxied) | Default value for proxied | `bool` | `false` | no | | [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | | [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no | | [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no | diff --git a/docs/terraform.md b/docs/terraform.md index abbbcdd..582d929 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -59,7 +59,8 @@ | [page\_rules](#input\_page\_rules) | A list of maps of Page Rules.
The values of map is fully compliant with `cloudflare_page_rule` resource.
To get more info see https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/cloudflare_page_rule | `list(any)` | `null` | no | | [paused](#input\_paused) | Whether this zone is paused (traffic bypasses Cloudflare) | `bool` | `false` | no | | [plan](#input\_plan) | The name of the commercial plan to apply to the zone. Possible values: `free`, `pro`, `business`, `enterprise` | `string` | `"free"` | no | -| [records](#input\_records) | name:
The name of the record.
type:
The type of the record.
value:
The value of the record.
ttl:
The TTL of the record.
Default value: 1.
priority:
The priority of the record.
proxied:
Whether the record gets Cloudflare's origin protection.
Default value: false. | `list(any)` | `[]` | no | +| [records](#input\_records) | name:
The name of the record.
type:
The type of the record.
value:
The value of the record.
comment:
Optional comment for the record.
ttl:
The TTL of the record.
Default value: 1.
priority:
The priority of the record.
proxied:
Whether the record gets Cloudflare's origin protection.
Default value: Taken from records\_default\_proxied variable | `list(any)` | `[]` | no | +| [records\_default\_proxied](#input\_records\_default\_proxied) | Default value for proxied | `bool` | `false` | no | | [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | | [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no | | [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |