deprecated-interpolation
What it does
Section titled “What it does”Reports a string that is one interpolation, "${var.a}", where the expression alone does. The fix writes the expression. It is not reported in Nomad job files (.nomad, .nomad.hcl), whose agent fills those in at run time.
Why it matters
Section titled “Why it matters”Since Terraform 0.12 an expression can stand alone, and wrapping it in a string turns the value into a string, which loses its type (a list or a number becomes text) and adds noise.
Example
Section titled “Example”resource "a" "b" { name = "${var.name}" tags = ["${var.a}", "x-${var.b}", "${var.c}${var.d}"] id = "${ var.e }" raw = "${~ var.f ~}"... all = aws_instance.web[0].id ids = aws_instance.web.*.id... key = { "${var.k}" = 1 } sum = 1 + "${var.n}"}resource "a" "b" { name = var.name tags = [var.a, "x-${var.b}", "${var.c}${var.d}"] id = var.e raw = "${~ var.f ~}"... all = aws_instance.web[0].id ids = aws_instance.web.*.id... key = { (var.k) = 1 } sum = 1 + "${var.n}"}Configuration
Section titled “Configuration”hcl: lint: rules: deprecated-interpolation: level: warn # off, warn (default), error options: except_in: []| Option | Type | Default | Description |
|---|---|---|---|
except_in |
list | [] |
Kinds of the parent (for example Tuple) whose strings are left alone. Tuple: only a string that is a whole argument is reported and unwrapped, as terraform fmt does. |
Enabled by the presets: hcl/tflint-recommended.
Suppress one line with sudsy-disable-next-line deprecated-interpolation 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_interpolation |
full |