Skip to content

typed-variables

Reports a variable block with no type argument.

Without a type any value is accepted and converted when it is used, so a wrong value (a string where a list was meant) is found late, with an error far from the variable. A type checks the value when it is given and documents what is expected.

To fix, add type.

Reported
variable "plain" {}
variable "full" {
type = string
...
hcl:
lint:
rules:
typed-variables: warn # off (default), warn, error

Enabled by the presets: hcl/tflint-recommended.

Suppress one line with sudsy-disable-next-line typed-variables in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
tflint terraform_typed_variables full