Validation of availability_zone_count were introduced not far ago. It looks valid but fails if I passing
availability_zone_count = 2
instance_count = 2
in terragrunt inputs with error:
│ Error: Invalid value for variable
│
│ on variables.tf line 115:
│ 115: variable "availability_zone_count" {
│
│ The availibility zone count must be 2 or 3.
│
│ This was checked by the validation rule at variables.tf:120,3-13.
But if I do not provide value at all, default value 2 working good. I was able to fix it by adding tonumber() func:
variable "availability_zone_count" {
type = number
default = 2
description = "Number of Availability Zones for the domain to use."
validation {
condition = contains([2, 3], tonumber(var.availability_zone_count))
error_message = "The availibility zone count must be 2 or 3."
}
}
Environment (please complete the following information):
Describe the Bug
Validation of
availability_zone_count
were introduced not far ago. It looks valid but fails if I passingin terragrunt inputs with error:
But if I do not provide value at all, default value 2 working good. I was able to fix it by adding tonumber() func:
Environment (please complete the following information):
Terraform v1.1.4 on darwin_arm64
Additional Context
I'm not sure where error is, in terraform which doing casting of variables in
contains
function or somewhere else.