From ffe635b58f03538b9788e263fbdcbffe1de5a49a Mon Sep 17 00:00:00 2001 From: Miren Esnaola Date: Wed, 19 Jul 2023 16:01:06 +0200 Subject: [PATCH] enable-logging flag can only be true for public zones --- modules/dns/README.md | 2 +- modules/dns/main.tf | 2 +- modules/dns/variables.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/dns/README.md b/modules/dns/README.md index 4e9a882f5a..307e745152 100644 --- a/modules/dns/README.md +++ b/modules/dns/README.md @@ -150,7 +150,7 @@ module "public-dns" { | [description](variables.tf#L21) | Domain description. | string | | "Terraform managed." | | [iam](variables.tf#L27) | IAM bindings in {ROLE => [MEMBERS]} format. | map(list(string)) | | null | | [recordsets](variables.tf#L43) | Map of DNS recordsets in \"type name\" => {ttl, [records]} format. | map(object({…})) | | {} | -| [zone_config](variables.tf#L78) | DNS zone configuration. | object({…}) | | null | +| [zone_config](variables.tf#L78) | DNS zone configuration. | object({…}) | | null | ## Outputs diff --git a/modules/dns/main.tf b/modules/dns/main.tf index d10b63199e..2c4c823031 100644 --- a/modules/dns/main.tf +++ b/modules/dns/main.tf @@ -139,7 +139,7 @@ resource "google_dns_managed_zone" "dns_managed_zone" { } } cloud_logging_config { - enable_logging = try(var.zone_config.enable_logging, false) + enable_logging = try(var.zone_config.public.enable_logging, false) } } diff --git a/modules/dns/variables.tf b/modules/dns/variables.tf index 1a9acf02c9..1d06792d23 100644 --- a/modules/dns/variables.tf +++ b/modules/dns/variables.tf @@ -79,7 +79,6 @@ variable "zone_config" { description = "DNS zone configuration." type = object({ domain = string - enable_logging = optional(bool, false) forwarding = optional(object({ forwarders = optional(map(string)) client_networks = list(string) @@ -101,6 +100,7 @@ variable "zone_config" { { algorithm = "rsasha256", key_length = 1024 } ) })) + enable_logging = optional(bool, false) })) private = optional(object({ client_networks = list(string)