Terraform Deprecated Syntax Checker

Find the syntax that changed in 0.12, 0.13 and since. Some of it still works and will not forever; some of it a current Terraform refuses outright, with an error that does not mention the rename.

Paste below, or drop a file anywhere on this panel

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 Check. Nothing leaves this tab.

Examples

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.

A quoted type name

Correct in 0.11 and an error since 0.12

variable "region" {
  type = "string"
}

The template_file data source

The provider has no Apple Silicon build, so init fails on a recent Mac

data "template_file" "init" {
  template = file("init.sh")
}

An interpolation-only string

Still works, and converts the result to a string on the way through

bucket = "${var.bucket_name}"

Common mistakes

These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.

  1. Treating an unknown function error as a provider problem

    list() and map() were removed in 0.12, and the error names an unknown function. People go looking for a provider that supplies it.

    Instead:Use the literal syntax: ["a", "b"] and { a = "b" }.

  2. Wrapping every expression in quotes and ${ }

    It works and it converts the result to a string, so a number or a list becomes text and the type error appears far from the cause.

    Instead:Write the expression bare: region = var.region.

  3. Keeping template_file because it still works

    The template provider has no darwin_arm64 build, so the configuration cannot init at all on a recent Mac. The failure arrives with a new laptop, not with a change to the code.

    Instead:Use the built-in templatefile(path, vars) function. No provider needed.

The errors for old syntax rarely mention what replaced it

That is what makes this category expensive: the message describes the symptom accurately and says nothing about the version the syntax came from.

A quoted primitive type is an error now

type = "string" was correct in 0.11. From 0.12 the type is a keyword, and the quoted form has been rejected for several majors. It survives in modules nobody has needed to touch, and the fix is to remove the quotes and, for a collection, say what it holds: list(string).

list() and map() were removed in 0.12

They are still all over copied snippets. The error names an unknown function, which reads like a missing provider rather than a removed builtin. The literal forms are ["a", "b"] and { a = "b" }.

An interpolation-only string converts its result

region = "${var.region}" still works, and it turns whatever the expression produced into a string. A number or a list silently becomes text and the type error appears somewhere else entirely. Write the expression bare.

template_file cannot init on Apple Silicon

The template provider is deprecated and has no darwin_arm64 build, so a configuration using it fails at init on any recent Mac. That is usually how a team discovers the deprecation. The built-in templatefile(path, vars) function needs no provider at all.

version inside a provider block is ignored when required_providers exists

Deprecated since 0.13, and still accepted. When both are present the required_providers entry wins, so the line you are reading is not necessarily the one in force, and the two can disagree indefinitely.

null_resource has a built-in replacement

terraform_data arrived in 1.4 and does the same job with no provider to download, lock or hash. null_resource still works; it is one more thing in your lock file for no benefit.