diff --git a/main.tf b/main.tf index 5163244b..6b7fab72 100644 --- a/main.tf +++ b/main.tf @@ -359,7 +359,7 @@ resource "ibm_is_flow_log" "flow_logs" { # ############################################################################## resource "ibm_dns_zone" "dns_zone" { - count = var.enable_hub && !var.skip_custom_resolver_hub_creation && var.dns_zone_name != null ? 1 : 0 + count = var.enable_hub && !var.skip_custom_resolver_hub_creation && alltrue([var.dns_zone_name != null, var.dns_zone_name != ""]) ? 1 : 0 name = var.dns_zone_name instance_id = var.use_existing_dns_instance ? var.existing_dns_instance_id : ibm_resource_instance.dns_instance_hub[0].guid description = var.dns_zone_description diff --git a/variables.tf b/variables.tf index 0d8ed2e5..6428db7f 100644 --- a/variables.tf +++ b/variables.tf @@ -644,7 +644,7 @@ variable "dns_zone_name" { type = string validation { - condition = var.enable_hub && !var.skip_custom_resolver_hub_creation ? length(coalesce(var.dns_zone_name, "")) > 0 : true + condition = var.enable_hub && !var.skip_custom_resolver_hub_creation ? alltrue([var.dns_zone_name != null, var.dns_zone_name != ""]) : true error_message = "dns_zone_name must not be null or empty when enable_hub is true and skip_custom_resolver_hub_creation is false." }