A null in the middle
Renders as nothing, so the result looks valid and is missing a piece
name = "web"
suffix = null
"${name}-${suffix}" See what a string with ${ } in it actually produces, and what each piece converts to on the way in. Type conversion is where interpolation goes wrong, and it goes wrong quietly.
Or drop a file anywhere on this panel. Nothing is uploaded: the analysis runs in this tab.
The answer appears here
Paste on the left and press Test. Nothing leaves this tab.
Nothing else to flag.
No formatting problems, and nothing the rules object to. Worth remembering what that covers: this reads the file you pasted, not the account or cluster it will be applied to.
No finding matches that filter.
Real input you can load into the tool above. Each one shows a different thing going wrong, because that is what the tool is for.
Renders as nothing, so the result looks valid and is missing a piece
name = "web"
suffix = null
"${name}-${suffix}"The quotes are doing nothing but converting the result to a string
count = 3
"${count}"Arithmetic only, and the error message does not mention strings
a = "hello" b = "world" a + b
These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.
It renders as an empty string, so the result is a valid-looking value that is quietly missing a piece. Nothing errors and nothing warns.
Instead:Guard it: "${x == null ? "default" : x}", or use coalesce(x, "default").
The quotes convert the result to a string, so a number or a list stops being one and the type error appears somewhere else entirely.
Instead:Write var.thing bare.
Terraform tries to resolve every ${ } as an expression and fails on names that belong to the shell.
Instead:Escape them as ${ }, or move the script to a file and use templatefile with an explicit map.
A number and a bool become their text. A list or an object is an error. null becomes an empty string, silently, and that is the one that reaches production.
Terraform does not print the word null and does not fail. "${a}-${b}" with b null gives "value-", so a resource ends up named with a trailing dash, a URL loses a path segment, or a tag is set to a prefix. Nothing in the plan looks wrong, because the value is a perfectly valid string.
Since 0.12 the expression can be written bare. "${var.count}" is not var.count: it is the string form of it, so a number becomes text and the type error appears wherever the value is used rather than where it was written. If the whole value is one expression, drop the quotes.
There is no default rendering, so this is an error rather than a surprise. jsonencode() is the answer when you mean to embed the structure, and join() when you mean to flatten a list of strings.
Which is how a shell script, a Docker Compose file or anything else using ${ } survives being put in a Terraform string. This is the same escape templates use, and forgetting it is the commonest reason a user_data script fails to render.
The operator is arithmetic only, so "a" + "b" is an error whose message talks about types. Almost every other language does the opposite, which is why this is the mistake people make once and remember.
Whether the value is what you meant, only what the interpolation does to it. Everything runs in your browser and nothing is uploaded, so real values are safe to paste in as bindings.