Skip to content

Commit

Permalink
Test can() function in variable validation
Browse files Browse the repository at this point in the history
  • Loading branch information
rfk-nc committed Feb 11, 2025
1 parent aa87e2c commit 2722027
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion infrastructure/modules/storage/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ variable "private_endpoint_properties" {
})

validation {
condition = var.private_endpoint_properties.private_endpoint_enabled == false || (length(var.private_endpoint_properties.private_dns_zone_ids_blob) > 0 && length(var.private_endpoint_properties.private_dns_zone_ids_queue) > 0 && length(var.private_endpoint_properties.private_endpoint_subnet_id) > 0)
condition = can(var.private_endpoint_properties.private_endpoint_enabled == false) || can(var.private_endpoint_properties.private_endpoint_enabled == true)
#condition = var.private_endpoint_properties.private_endpoint_enabled == false || (length(var.private_endpoint_properties.private_dns_zone_ids_blob) > 0 && length(var.private_endpoint_properties.private_dns_zone_ids_queue) > 0 && length(var.private_endpoint_properties.private_endpoint_subnet_id) > 0)
error_message = "Both private_dns_zone_ids and private_endpoint_subnet_id must be provided if private_endpoint_enabled is true."
}
}
Expand Down

0 comments on commit 2722027

Please sign in to comment.