OpenTofu Error: 'Unsupported argument' — Cause, Fix, and Troubleshooting Guide
Fix OpenTofu 'Error: Unsupported argument' from typos, deprecated/removed provider fields, wrong nesting, or provider version drift.
- #opentofu
- #iac
- #troubleshooting
- #errors
Fixing errors like this? Get 500 free DevOps AI prompts
500 copy-paste AI prompts for the stack you actually run — one PDF, free.
Overview
Every resource, data source, and module accepts a fixed set of arguments defined by its schema. If you set an argument the schema does not recognize — a typo, a removed field, or one that belongs in a nested block — OpenTofu rejects the configuration:
Error: Unsupported argument
on main.tf line 15, in resource "aws_s3_bucket" "logs":
15: acl = "private"
An argument named "acl" is not expected here.
Symptoms
tofu validate/planfails withUnsupported argumentand the offending line.- The message says the argument “is not expected here.”
- It commonly appears after a major provider upgrade that removed or relocated a field.
- Also appears from module calls that pass a variable the module does not declare.
Common Root Causes
- Typo —
instace_typeinstead ofinstance_type. - Removed argument after a provider major bump — e.g., inline
aclonaws_s3_bucketmoved to a separateaws_s3_bucket_aclresource. - Wrong nesting — the argument belongs inside a nested block, not at the top level.
- Module input not declared — passing
foo = ...to a module with novariable "foo". - Copied config for a different resource type with a similar but not identical schema.
How to diagnose
Read the line OpenTofu flags, then check the current schema for that resource:
tofu validate
tofu providers schema -json | jq '.provider_schemas | keys'
Inspect the exact attributes a resource type supports:
tofu providers schema -json \
| jq '.provider_schemas["registry.opentofu.org/hashicorp/aws"].resource_schemas["aws_s3_bucket"].block.attributes | keys'
For a module call, list the variables the module actually declares:
grep -rn 'variable ' modules/logging/
Fixes
Fix a typo to match the schema attribute name exactly:
resource "aws_instance" "web" {
instance_type = "t3.micro" # was instace_type
}
Migrate a removed argument to its new form. For AWS S3 ACLs after provider v4+:
resource "aws_s3_bucket" "logs" {
bucket = "example-logs"
}
resource "aws_s3_bucket_acl" "logs" {
bucket = aws_s3_bucket.logs.id
acl = "private"
}
Move the argument into the correct nested block if the schema nests it:
resource "aws_launch_template" "web" {
block_device_mappings {
device_name = "/dev/xvda"
ebs {
volume_size = 20
}
}
}
Declare the module variable if you meant to pass a new input:
# modules/logging/variables.tf
variable "retention_days" {
type = number
}
What to watch out for
- Read provider upgrade guides before a major bump — removed/relocated arguments are the top source of this error.
tofu providers schema -jsonis the source of truth for what a resource accepts; grep it instead of guessing.- Module inputs must be declared with
variableblocks; an undeclared input is “unsupported.” - Pin provider versions so a schema change does not appear unexpectedly on the next
init -upgrade.
Related
- OpenTofu Error: ‘Missing required argument’ — Cause, Fix, and Troubleshooting Guide
- OpenTofu Error: ‘Reference to undeclared resource’ — Cause, Fix, and Troubleshooting Guide
- OpenTofu Error: ‘Unsuitable value type’ — Cause, Fix, and Troubleshooting Guide
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.