Quick Answer
# Check what attributes exist
terraform console
> aws_instance.web
# Or check provider docs
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance
The Error
Error: Unsupported attribute
on outputs.tf line 3, in output "public_ip":
3: value = aws_instance.web.public_ip_address
|
| aws_instance.web is a object, known only after apply
This object does not have an attribute named "public_ip_address".
Did you mean "public_ip"?
Or:
Error: Unsupported argument
on main.tf line 8, in resource "aws_instance" "web":
8: vpc_security_groups = [aws_security_group.web.id]
An argument named "vpc_security_groups" is not expected here.
Did you mean "vpc_security_group_ids"?
What Causes This
- Typo in attribute name —
public_ip_addressinstead ofpublic_ip - Wrong argument name —
vpc_security_groupsinstead ofvpc_security_group_ids - Provider version change — attribute renamed or removed in newer version
- Deprecated attribute — still works but will be removed
- Wrong resource type — looking at
aws_instancedocs when you haveaws_spot_instance_request
Solution 1: Check Provider Documentation
Go to the Terraform Registry and find the exact resource:
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance
Look at the Attributes Reference section for available output attributes, and Argument Reference for input arguments.
Solution 2: Use terraform console
terraform console
# Explore a resource
> aws_instance.web
{
"ami" = "ami-abc123"
"id" = "i-0abc123"
"instance_type" = "t3.micro"
"public_ip" = "1.2.3.4"
...
}
# Check specific attribute
> aws_instance.web.public_ip
"1.2.3.4"
Solution 3: Use providers schema
terraform providers schema -json | jq '.provider_schemas["registry.terraform.io/hashicorp/aws"].resource_schemas["aws_instance"].attributes | keys'
Solution 4: Common Attribute Mistakes
| Wrong | Correct |
|---|---|
public_ip_address | public_ip |
private_ip_address | private_ip |
vpc_security_groups | vpc_security_group_ids |
ami_id | ami |
subnet | subnet_id |
security_groups (EC2-Classic) | vpc_security_group_ids (VPC) |
name (on aws_instance) | tags.Name |
arn (on some resources) | Check — not all resources export ARN |
Solution 5: Handle Provider Version Changes
# Pin provider version to avoid surprises
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
If upgrading caused the error, check the provider changelog:
# Find current version
terraform version
# Check upgrade guide
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-5-upgrade
Solution 6: Deprecated Attributes
Some attributes get deprecated before removal:
Warning: Argument is deprecated
"security_groups" is deprecated, use "vpc_security_group_ids" instead
Fix now before it becomes an error in the next major version.
Hands-On Courses
- Terraform for Beginners on CopyPasteLearn
- Terraform By Example — practical code examples
Conclusion
Unsupported attribute means the name is wrong. Check the provider docs on the Terraform Registry, use terraform console to explore available attributes, and watch for Terraform’s “Did you mean…?” suggestions. Pin provider versions to avoid attributes disappearing on upgrade.