diff --git a/modules/dns/README.md b/modules/dns/README.md index 7798a659..8739bbb0 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 7547cec1..bb106eb3 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 4561a98d..d23d949a 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))