Skip to content

Commit c42165a

Browse files
fix: validation logic for dns_zone_name when set to null (#922)
Co-authored-by: toddgiguere <[email protected]>
1 parent c52640b commit c42165a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ resource "ibm_is_flow_log" "flow_logs" {
359359
# ##############################################################################
360360

361361
resource "ibm_dns_zone" "dns_zone" {
362-
count = var.enable_hub && !var.skip_custom_resolver_hub_creation && var.dns_zone_name != null ? 1 : 0
362+
count = var.enable_hub && !var.skip_custom_resolver_hub_creation && alltrue([var.dns_zone_name != null, var.dns_zone_name != ""]) ? 1 : 0
363363
name = var.dns_zone_name
364364
instance_id = var.use_existing_dns_instance ? var.existing_dns_instance_id : ibm_resource_instance.dns_instance_hub[0].guid
365365
description = var.dns_zone_description

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ variable "dns_zone_name" {
644644
type = string
645645

646646
validation {
647-
condition = var.enable_hub && !var.skip_custom_resolver_hub_creation ? length(coalesce(var.dns_zone_name, "")) > 0 : true
647+
condition = var.enable_hub && !var.skip_custom_resolver_hub_creation ? alltrue([var.dns_zone_name != null, var.dns_zone_name != ""]) : true
648648
error_message = "dns_zone_name must not be null or empty when enable_hub is true and skip_custom_resolver_hub_creation is false."
649649
}
650650

0 commit comments

Comments
 (0)