terraform/internal/configs/testdata/invalid-files/variable-validation-condition-noself.tf
James Bardin acc4c12ac2 variable validation rules must still point to self
While variable validation rules can now include other references, they
also still need to reference the variable itself. If the variable itself
wasn't referenced, then the resulting `Invalid value for variable`
error would not make sense.

Having no self-references will also cause a panic when trying to
reinsert the variable name into the evaluation context, because the
context variables map could be nil. A check for a nil map does not need
to be added however, because ensuring that a self-reference exists means
there will always be at least 1 variable in scope.
2024-06-03 16:15:40 -04:00

10 lines
162 B
HCL

locals {
something = "else"
}
variable "validation" {
validation {
condition = local.something == "else"
error_message = "Something else."
}
}