no-redundant-variable-validation
Flag Terraform variable validation conditions already guaranteed by the variable's type constraint.
Why
Terraform applies a declared type constraint before custom validation. Rechecking that the same value can be read, converted to its declared type, or exhausts a non-nullable boolean domain adds a second contract that cannot reject a valid input and obscures the validations that enforce real domain rules.
Fix
Delete the redundant validation block. Keep validation for narrower domain requirements such as ranges, formats, enums, nullability, and relationships between fields.
Examples
variable "region" { type = string validation { condition = can(tostring(var.region)) error_message = "Region must be a string." }}variable "region" { type = string validation { condition = can(regex("^[a-z]+-[a-z]+[0-9]+$", var.region)) error_message = "Region must use the provider region format." }}variable "enabled" { type = bool nullable = false validation { condition = contains([true, false], var.enabled) error_message = "Enabled must be true or false." }}variable "enabled" { type = bool validation { condition = contains([true, false], var.enabled) error_message = "Enabled must not be null." }}