fixes validation

This commit is contained in:
Maciej Sikora
2025-06-17 11:20:13 +02:00
committed by Wiktor Niesiobędzki
parent 1d8e48f9e4
commit 1dd4873a02
3 changed files with 20 additions and 28 deletions

View File

@@ -133,17 +133,9 @@ variable "iap_config" {
})
default = null
validation {
condition = var.iap_config == null || (
(try(var.iap_config.iam, null) != null && try(var.iap_config.iam_additive, null) == null) ||
(try(var.iap_config.iam, null) == null && try(var.iap_config.iam_additive, null) != null)
)
error_message = "When iap_config is provided, exactly one of 'iam' or 'iam_additive' must be specified."
}
validation {
condition = !(length(try(var.iap_config.iam, [])) > 0 && length(try(var.iap_config.iam_additive, [])) > 0)
)
error_message = "When 'iam' or 'iam_additive' lists are provided in iap_config, they must not be empty."
}