deprecated-index
What it does
Section titled “What it does”Reports a list item read with the legacy dot syntax, a.0. The fix writes a[0].
Why it matters
Section titled “Why it matters”The dot form is a deprecated spelling of the index. Newer versions of the language reject it or treat it differently, and the bracket form works with every expression.
Example
Section titled “Example”... raw = "${~ var.f ~}" id2 = aws_instance.web.0.id all = aws_instance.web[0].id ids = aws_instance.web.*.id num = local.versions.1.2...}... raw = "${~ var.f ~}" id2 = aws_instance.web[0].id all = aws_instance.web[0].id ids = aws_instance.web.*.id num = local.versions[1][2]...}Configuration
Section titled “Configuration”hcl: lint: rules: deprecated-index: warn # off, warn (default), errorEnabled by the presets: hcl/tflint-recommended.
Suppress one line with sudsy-disable-next-line deprecated-index in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| tflint | terraform_deprecated_index |
full |