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 only proven redundant validation. The guard-block policy also prohibits substantive validation, but ranges, formats, enums, null restrictions and cross-field safeguards require equivalent protection at their authoritative owner before a reviewed removal.
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." }}