You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@jbardin AFAIK the terraform 1.5 check blocks are essentially post-apply/postcondition validation, whereas input validation is typically a pre-apply/pre-condition step. is there a way to have check blocks fire before a resource attempts application?
@briceburg, check blocks will be evaluated during plan, but yes, they will not block application of that plan. If you need to halt execution as early as possible, you can create a precondition at the point where the variables are used, or insert an empty resource like terraform_data to give you a location for a precondition where both variables are in scope.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Terraform Version
Use Cases
Validation of a variable based on another variable.
Currently, while declaring a variable there is a
But, if I use that validation to check another variable as below,
I get the error -
The condition for variable "somevar" can only refer to the variable
│ itself, using var.somevar.
Would be a good addition to enable such a feature.
Attempted Solutions
But, if I use that validation to check another variable as below,
I get the error -
The condition for variable "somevar" can only refer to the variable
│ itself, using var.somevar
Proposal
Proposing that a condition in a validation block be allowed to check the validation for another variable and set this one accordingly.
References
No response
The text was updated successfully, but these errors were encountered: