Skip to content

/errors/terraform/unsupported-argument

Terraform: Error: Unsupported argument. An argument named "x" is not expected here

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · Terraform v1.16.6updated 2026-10-20
tool
Terraform
exit code
1
versions
Terraform 1.x, OpenTofu 1.x
os
any

Terraform checks every block against the schema of its resource type, data source or module. An attribute that the schema does not define stops validate, plan and apply with Error: Unsupported argument and An argument named "x" is not expected here., pointing at the file and line.

Reproduce it

The built-in terraform_data resource has input and triggers_replace, but no name:

bash
cat > main.tf <<'EOF'
resource "terraform_data" "app" {
  input = "x"
  name  = "web"
}
EOF
terraform init -input=false -no-color >/dev/null
terraform validate -no-color

Output · exit 1

Error: Unsupported argument

  on main.tf line 3, in resource "terraform_data" "app":
   3:   name  = "web"

An argument named "name" is not expected here.

Fix it

  1. Open the resource's page in the provider documentation for the version you use (see .terraform.lock.hcl) and compare the attribute names.

  2. If the attribute is newer than your provider, raise the constraint and run terraform init -upgrade:

    hcl
    terraform {
      required_providers {
        aws = {
          source  = "hashicorp/aws"
          version = "~> 6.0"
        }
      }
    }
  3. If the schema defines it as a block, drop the =:

    hcl
    # wrong
    root_block_device = { volume_size = 20 }
    # right
    root_block_device {
      volume_size = 20
    }

For a module, Unsupported argument means the module has no variable with that name: add it to the module's variables.tf, or stop passing it.

Sources