no-redundant-variable-validation
Flag Terraform variable validations already guaranteed by the declared type or nullability.
Why
Terraform applies declared type and nullability constraints before custom validation. Rechecking readability, conversion to the declared type, non-nullability, or an exhaustive non-nullable boolean domain cannot reject another valid input and obscures actual domain requirements.
Fix
Delete the redundant validation block. Keep validation for narrower domain requirements such as ranges, formats, enums, otherwise permitted nulls, 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." }}Autofix output
variable "region" { type = string
}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." }}