From 0cae2ff08c07de069755f72929fa89411a868230 Mon Sep 17 00:00:00 2001 From: Veronika Priesner <125653631+nika-pr@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:20:51 +0200 Subject: [PATCH] added force_destroy to dns module (#2202) * added force_destroy to dns module * ran tfdoc.py modules/dns * set default of force_destroy to null * reran tfdoc.py after default value change --- modules/dns/README.md | 11 ++++++----- modules/dns/main.tf | 1 + modules/dns/variables.tf | 6 ++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/dns/README.md b/modules/dns/README.md index 7798a659e..8739bbb02 100644 --- a/modules/dns/README.md +++ b/modules/dns/README.md @@ -157,12 +157,13 @@ module "public-dns" { | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [name](variables.tf#L29) | Zone name, must be unique within the project. | string | ✓ | | -| [project_id](variables.tf#L34) | Project id for the zone. | string | ✓ | | +| [name](variables.tf#L35) | Zone name, must be unique within the project. | string | ✓ | | +| [project_id](variables.tf#L40) | Project id for the zone. | string | ✓ | | | [description](variables.tf#L17) | Domain description. | string | | "Terraform managed." | -| [iam](variables.tf#L23) | IAM bindings in {ROLE => [MEMBERS]} format. | map(list(string)) | | null | -| [recordsets](variables.tf#L39) | Map of DNS recordsets in \"type name\" => {ttl, [records]} format. | map(object({…})) | | {} | -| [zone_config](variables.tf#L83) | DNS zone configuration. | object({…}) | | null | +| [force_destroy](variables.tf#L23) | Set this to true to delete all records in the zone upon zone destruction. | bool | | null | +| [iam](variables.tf#L29) | IAM bindings in {ROLE => [MEMBERS]} format. | map(list(string)) | | null | +| [recordsets](variables.tf#L45) | Map of DNS recordsets in \"type name\" => {ttl, [records]} format. | map(object({…})) | | {} | +| [zone_config](variables.tf#L89) | DNS zone configuration. | object({…}) | | null | ## Outputs diff --git a/modules/dns/main.tf b/modules/dns/main.tf index 7547cec13..bb106eb3d 100644 --- a/modules/dns/main.tf +++ b/modules/dns/main.tf @@ -61,6 +61,7 @@ resource "google_dns_managed_zone" "dns_managed_zone" { name = var.name dns_name = var.zone_config.domain description = var.description + force_destroy = var.force_destroy visibility = local.visibility reverse_lookup = try(var.zone_config.private, null) != null && endswith(var.zone_config.domain, ".in-addr.arpa.") diff --git a/modules/dns/variables.tf b/modules/dns/variables.tf index 4561a98d5..d23d949a2 100644 --- a/modules/dns/variables.tf +++ b/modules/dns/variables.tf @@ -20,6 +20,12 @@ variable "description" { default = "Terraform managed." } +variable "force_destroy" { + description = "Set this to true to delete all records in the zone upon zone destruction." + type = bool + default = null +} + variable "iam" { description = "IAM bindings in {ROLE => [MEMBERS]} format." type = map(list(string))