The 'unsupported attribute' error occurs when you reference an attribute that doesn't exist on a Terraform resource, nested block, or data source. This typically happens due to typos in attribute names, incorrect syntax between arguments and blocks, provider version mismatches, or using deprecated attributes that have been removed or renamed.
When Terraform encounters an attribute reference on a resource or data source that isn't defined in that resource's schema, it raises this validation error. The error distinguishes between three concepts: arguments (which use = for assignment), nested blocks (which don't use =), and exported attributes (which can be referenced from other resources). Mixing these up—like trying to access a nested block as an argument, or using an outdated attribute name—triggers this error.
Carefully review the attribute name in your configuration. Common mistakes include:
# Wrong
resource "aws_instance" "example" {
availabilty_zone = "us-east-1a" # typo: availabilty
}
# Correct
resource "aws_instance" "example" {
availability_zone = "us-east-1a"
}Double-check against the official provider documentation for the exact spelling.
Terraform distinguishes between arguments (use =) and nested blocks (no =). Check if your attribute should be a block:
# Wrong: treating a block as an argument
resource "aws_security_group" "example" {
ingress = { # This is a nested block, not an argument
from_port = 80
}
}
# Correct: nested block syntax
resource "aws_security_group" "example" {
ingress { # No equals sign
from_port = 80
}
}Consult your provider documentation to determine if something should be a block or argument.
The attribute might not exist in your current provider version. Check what version you're using:
terraform providersOr view it in your state file. Then compare against your provider's changelog to see if:
- The attribute was renamed
- The attribute was removed
- The attribute is only available in newer versions
If upgrading, run terraform init to download the new provider version.
For a specific resource, you can list all available arguments and blocks:
terraform providers schema -json | jq '.provider_schemas["provider[registry.terraform.io/hashicorp/aws]"].resource_schemas["aws_instance"].block.attributes'This shows exactly what your current provider version supports. Look for the attribute name in the output.
If an attribute was removed, check the provider changelog for the recommended replacement:
# Old (removed in provider v5.0)
resource "aws_instance" "example" {
security_groups = ["default"] # Removed
}
# New (use vpc_security_group_ids instead)
resource "aws_instance" "example" {
vpc_security_group_ids = [aws_security_group.example.id]
}Replace the old attribute with the new one recommended in the changelog.
Once you've corrected the attribute name and syntax, validate your Terraform configuration:
terraform validateIf validation passes, you can safely run:
terraform planto see what changes Terraform wants to make.
Provider Schema Changes: When Terraform providers release major versions, they often remove deprecated attributes or restructure nested blocks. Always check the provider's CHANGELOG.md for 'BREAKING CHANGES' before upgrading.
Remote State Migration: If upgrading causes many 'unsupported attribute' errors in outputs or data sources referencing older state, you may need to migrate the state file or regenerate outputs.
Custom Providers: If using custom providers, verify the provider schema is correct by checking the provider's documentation or source code, as custom providers may have attributes that are misspelled in their schema definition.
terraform providers schema Command: This is the most reliable way to debug these issues, as it shows the exact schema your installed provider supports without needing to consult documentation.
Error: Error rendering template: template not found
How to fix "template not found" error in Terraform
Error: Error generating private key
How to fix 'Error generating private key' in Terraform
Error creating Kubernetes Service: field is immutable
How to fix "field is immutable" errors in Terraform
Error: Error creating local file: open: permission denied
How to fix "Error creating local file: permission denied" in Terraform
Error: line endings have changed from CRLF to LF
Line endings have changed from CRLF to LF in Terraform