From 2183d300d7e092abb99243fda735290f508b9670 Mon Sep 17 00:00:00 2001 From: borijani Date: Mon, 8 Dec 2025 16:23:50 +1000 Subject: [PATCH] add labels support to dns module (#3572) --- modules/dns/README.md | 9 +++++---- modules/dns/main.tf | 1 + modules/dns/variables.tf | 6 ++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/dns/README.md b/modules/dns/README.md index c1a68f4b2..c358709e0 100644 --- a/modules/dns/README.md +++ b/modules/dns/README.md @@ -190,14 +190,15 @@ module "public-dns" { | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [name](variables.tf#L47) | Zone name, must be unique within the project. | string | ✓ | | -| [project_id](variables.tf#L52) | Project id for the zone. | string | ✓ | | +| [name](variables.tf#L53) | Zone name, must be unique within the project. | string | ✓ | | +| [project_id](variables.tf#L58) | Project id for the zone. | string | ✓ | | | [context](variables.tf#L17) | Context-specific interpolations. | object({…}) | | {} | | [description](variables.tf#L29) | Domain description. | string | | "Terraform managed." | | [force_destroy](variables.tf#L35) | Set this to true to delete all records in the zone upon zone destruction. | bool | | null | | [iam](variables.tf#L41) | IAM bindings in {ROLE => [MEMBERS]} format. | map(list(string)) | | null | -| [recordsets](variables.tf#L57) | Map of DNS recordsets in \"type name\" => {ttl, [records]} format. | map(object({…})) | | {} | -| [zone_config](variables.tf#L114) | DNS zone configuration. | object({…}) | | null | +| [labels](variables.tf#L47) | Labels to be assigned to the zone. | map(string) | | {} | +| [recordsets](variables.tf#L63) | Map of DNS recordsets in \"type name\" => {ttl, [records]} format. | map(object({…})) | | {} | +| [zone_config](variables.tf#L120) | DNS zone configuration. | object({…}) | | null | ## Outputs diff --git a/modules/dns/main.tf b/modules/dns/main.tf index b00997766..f17c72234 100644 --- a/modules/dns/main.tf +++ b/modules/dns/main.tf @@ -69,6 +69,7 @@ resource "google_dns_managed_zone" "dns_managed_zone" { dns_name = var.zone_config.domain description = var.description force_destroy = var.force_destroy + labels = var.labels visibility = local.visibility reverse_lookup = var.zone_config.private == null ? false : var.zone_config.private.reverse_managed diff --git a/modules/dns/variables.tf b/modules/dns/variables.tf index b80188608..4b08a9c1f 100644 --- a/modules/dns/variables.tf +++ b/modules/dns/variables.tf @@ -44,6 +44,12 @@ variable "iam" { default = null } +variable "labels" { + description = "Labels to be assigned to the zone." + type = map(string) + default = {} +} + variable "name" { description = "Zone name, must be unique within the project." type = string