Hello,
my search skills are taking a leave today.
Problem statement:
i would like to check if a variable is in the list of allowed values.
not working code:
variable "vms" {
type = map(object({
instance_type = string
tag_productfamily = list(string)
}))
validation {
condition = length([for tag in values(var.vms)[*].tag_productfamily : tag if !contains(["AAA", "BB"], tag)]) <= 0
error_message = "Only AA and BB are allowed values for tag."
}
}
Appreciate your help.