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
Today the coder terraform provider only allows 1 validation block. There is value if we allow more than one, as it allow tailoring the error message based on the condition.
data "coder_parameter" "favorite_number" {
name = "favorite_number"
display_name = "What is your favorite Number?"
description = "Please enter your favorite number."
validation {
min = 0
error = "The number {value} is less than 0, please select something greater."
}
validation {
max = 100
error = "The number {value} is greater than 100, please select something less."
}
}
This is exceptionally useful when invalid is added as an argument.
data "coder_parameter" "favorite_number" {
name = "favorite_number"
display_name = "What is your favorite Number?"
description = "Please enter your favorite number."
validation {
min = 0
error = "The number {value} is less than 0, please select something greater."
}
validation {
max = 100
error = "The number {value} is greater than 100, please select something less."
}
validation {
error = "That number is superstitious, avoid choosing 13"
invalid = data.coder_parameter.favorite_number.value == 13
}
!However! this is invalid because you get this error:
│ Error: Self-referential block
│
│ on main.tf line 21, in data "coder_parameter" "favorite_number":
│ 21: invalid = data.coder_parameter.favorite_number.value == 13
The text was updated successfully, but these errors were encountered:
Today the coder terraform provider only allows 1
validation
block. There is value if we allow more than one, as it allow tailoring the error message based on the condition.This is exceptionally useful when
invalid
is added as an argument.!However! this is invalid because you get this error:
The text was updated successfully, but these errors were encountered: