-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Variable validation of type number fails #29899
Copy link
Copy link
Closed
Labels
bugconfigconfirmeda Terraform Core team member has reproduced this issuea Terraform Core team member has reproduced this issueexplaineda Terraform Core team member has described the root cause of this issue in codea Terraform Core team member has described the root cause of this issue in code
Description
Terraform Version
Terraform v1.0.10
on darwin_amd64
+ provider registry.terraform.io/hashicorp/null v3.1.0
Terraform Configuration Files
variable "my_number" {
type = number
validation {
condition = contains([1, 2, 3], var.my_number)
error_message = "Failed."
}
}
resource "null_resource" "this" {
}Debug Output
https://gist.github.com/Wuzyn/2d3c435df178ba8147f10b8c0430d6fb
Expected Behavior
Running terraform plan/apply and providing value from condition list should pass the validation
Actual Behavior
terraform plan
var.my_number
Enter a value: 1
╷
│ Error: Invalid value for variable
│
│ on main.tf line 1:
│ 1: variable "my_number" {
│
│ Failed.
│
│ This was checked by the validation rule at main.tf:3,3-13.
╵
Steps to Reproduce
terraform initterraform plan- Provide correct value, which should pass validation
Additional Context
References
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugconfigconfirmeda Terraform Core team member has reproduced this issuea Terraform Core team member has reproduced this issueexplaineda Terraform Core team member has described the root cause of this issue in codea Terraform Core team member has described the root cause of this issue in code