diff --git a/modules/dns/README.md b/modules/dns/README.md
index 4e9a882f5a..cdfff0e300 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..9c2bf54517 100644
--- a/modules/dns/variables.tf
+++ b/modules/dns/variables.tf
@@ -78,8 +78,7 @@ variable "recordsets" {
variable "zone_config" {
description = "DNS zone configuration."
type = object({
- domain = string
- enable_logging = optional(bool, false)
+ domain = string
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)