terraform state show: Usage & Common CI Errors
Inspect every attribute Terraform has recorded for one resource.
terraform state show prints the attributes of a single resource instance as stored in state - useful for debugging drift, finding IDs, and confirming what Terraform thinks it manages.
What it does
terraform state show <address> dumps the recorded attribute values for that resource instance (IDs, ARNs, computed fields). It reads state only; it does not query the provider for live values.
Common usage
# Show one resource's tracked attributes
terraform state show aws_instance.web
# Show an indexed/for_each instance (quote to protect from the shell)
terraform state show 'aws_instance.web[0]'
terraform state show 'module.db.aws_db_instance.this'Common error in CI: no instance found for the address
state show fails with "No instance found for the given address" when the address is wrong or the resource uses count/for_each (so it is web[0], not web). Fix: run terraform state list first to copy the exact address, and quote bracketed addresses so the shell does not glob them. If the resource truly is not in state, import it or run plan to see why.
Key options
| Option | Purpose |
|---|---|
| <address> | Required: the resource instance to show |
| -state=FILE | Read from a specific state file |