Skip to main content
DevOps Insightsguides & answers

Terraform · troubleshooting

Error: Unsupported argument

Terraform does not accept a name you used inside a block: the resource, data source or module has no argument or nested block with that name. Usually a typo, an argument written as a block or the reverse, a module input the module does not declare, or a provider version that does not have it.

Reproduced on Terraform 1.14.0, . Where the text says “reproduced”, the behaviour was run on that version, not taken from documentation.

First published

New to this? Read what is actually happening first, then come back to the steps.

On this page · 8 sections

Before you start

  • terraform init run in the directory, so the providers and modules whose schema is checked are installed.

Run this first

step 1 of 1
terraform validate

Look for The block and line named, and any Did you mean suggestion

Checks every block against the installed schemas without calling any provider API.

Work out which cause you have

A few questions to narrow the list. Every answer ends in a command that confirms or rules the cause out — this cannot see your cluster, so nothing here is a certainty until you have checked.

Narrow it down

0 answered · nothing is sent anywhere

Does the message include a Did you mean line?

Cause space

3 of 3 still possible

  • A typo, or an argument written as a block (or the reverse)Common
  • The installed provider version does not have this argumentCommon
  • A module input the module does not declareCommon

Nothing ruled out yet. Answer the question above and the branches your answer eliminates will strike through here.

Or diagnose it manually

In this order. The first command usually contains the whole answer.

  1. Step 1

    terraform validate

    Checks every block against the installed schemas without calling any provider API.

    Look for The block and line named, and any Did you mean suggestion

Every cause, and how to fix it

Ordered by how often each one turns out to be the answer.

A typo, or an argument written as a block (or the reverse)

Common

The name is slightly wrong, or the equals sign is missing or extra: tags { } instead of tags = { }, or lifecycle = { } instead of lifecycle { }.

Confirm

terraform validate

A Did you mean line naming the right name, or telling you to use the equals sign

Fix

  • Use the suggested name, or add or remove the equals sign as the message says.

The installed provider version does not have this argument

Common

The example or module you copied was written for a different provider version. The argument may be newer than your version, or removed or moved to a separate resource in a major release.

Confirm

terraform version

The provider version, compared with the version of the documentation you followed

Fix

  • Read the resource's documentation for the provider version you actually run (the registry has a version selector), and the provider's upgrade guide for that major version.
  • Or change the version constraint in required_providers and run terraform init -upgrade, if the newer version is what you want.
terraform providers schema -json | jq -c '.provider_schemas[].resource_schemas["TYPE"] // empty | .block | {arguments: (.attributes | keys), blocks: ((.block_types // {}) | keys)}'

A check, not a change: it lists the names this provider version accepts for TYPE (needs jq), including read-only attributes such as id. Checked on Terraform 1.14.0.

A module input the module does not declare

Common

Inside a module block, every argument other than meta-arguments such as source, version, count and providers must match a variable in the module. A module version that dropped or renamed a variable gives this error after an upgrade.

Confirm

grep -rn 'variable "NAME"' PATH-TO-MODULE    # the module's source folder, or .terraform/modules/ for a downloaded one

No variable with that name in the module's files

Fix

  • Remove the argument, or rename it to the variable the module now uses; the module's changelog or README lists them.
  • Or pin the module version that still had it, while you migrate.

Understanding it properly

Skip this if you are mid-incident — the working part of the page is above. Worth reading afterwards, because understanding the mechanism is what stops the next one.

In plain terms

Every resource, data source and module has a fixed list of names it accepts, set by the provider version or the module's variables. Terraform checks your configuration against that list before planning. Terraform stops there if a name is not on the list, or if you wrote it in the wrong form: as a block (name { }) when it should be an argument (name = value), or the other way round.

Words used on this page

Argument
name = value inside a block, such as input = "x".
Nested block
name { ... } with no equals sign, such as lifecycle { }. A schema decides which names are blocks and which are arguments.
Schema
The list of arguments and blocks a provider version defines for each resource type. terraform providers schema -json prints it.
What is actually happening

Reproduced on Terraform 1.14.0 with terraform validate. A typo, inputs for input, printed Error: Unsupported argument and An argument named "inputs" is not expected here. Did you mean "input"?

Writing an argument as a block, input { ... }, printed Error: Unsupported block type and Did you mean to define argument "input"? If so, use the equals sign to assign it a value. The reverse, lifecycle = { ... } where lifecycle is a block, printed Unsupported argument with no suggestion.

Passing region to a module that declares only a name variable printed the same Unsupported argument: for a module, the accepted names are its variable blocks.

When a provider adds an argument in a newer version or removes one in a major version, configuration written for one version fails this check under the other. That follows from how the check works; it was not reproduced here, because no real provider was downloaded.

How to tell this is your problem
WhereWhat you see
terraform validate, plan or applyError: Unsupported argument ... An argument named "NAME" is not expected here.
Block written where an argument belongsError: Unsupported block type ... Did you mean to define argument "NAME"? If so, use the equals sign to assign it a value.

How to know it is actually fixed

  • terraform validate prints Success! The configuration is valid.

Stopping it happening again

  • Pin provider and module versions, and read the upgrade guide before raising a major version.
  • Run terraform validate in CI on every pull request.

Sources

Behaviour described here is drawn from official documentation. Where a figure could not be confirmed on an official page it is attributed in the text rather than stated as canonical.

Did this get you to an answer?

No text box on purpose — please do not paste production logs anywhere

Something wrong or out of date? Report it