Terraform: Error: Invalid target address — No matching objects found. To view the available instances, use "terraform state list"
A state/target command referenced an address that doesn't exist in state.
Error: Invalid target addressNo matching objects found. To view the available instances, use "terraform state list"Error: Invalid target address: No matching objects foundError: Invalid address: Resource instance keys not allowedError: Invalid target address Resource specification must include a resource type and name Meaning
Run terraform state list and copy the exact address, including indexes/keys and module paths (module.x.aws_instance.web["a"]). Quote addresses with brackets in the shell ('aws_instance.web[0]'). Check workspace/backend is the right one — empty state lists nothing.
Common causes
- Typo/wrong address
- Missing index/key for count/for_each
- Shell treating brackets/quotes
- Wrong workspace/backend
- Resource already removed
⚡ Quick fix
terraform state list | grep NAME- Quote the address:
terraform state rm 'aws_instance.web["a"]' - Check
terraform workspace show
Detailed fix by platform
Terraform
terraform state list | grep web; terraform state show 'aws_instance.web[0]'
How to diagnose
- Address — In state list?
- Quotes — Shell safe?
- Workspace — Right?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Backend configuration changed (migrate or reconfigure) Terraform: Error: Backend configuration changed — A change in the backend configuration has been detected, which may require migrating existing state
- Cannot import non-existent remote object Terraform: Error: Cannot import non-existent remote object — While attempting to import an existing object to "aws_s3_bucket.logs", the provider detected that no object exists with the given id
- docker-compose: command not found docker-compose: command not found / 'compose' is not a docker command
Most viewed in Terraform
- Error acquiring the state lock Terraform: Error: Error acquiring the state lock — ConditionalCheckFailedException / state blob is already locked
- Inconsistent dependency lock file Terraform: Error: Inconsistent dependency lock file — provider x: required by this configuration but no version is selected
- Reference to undeclared resource Terraform: Error: Reference to undeclared resource / Reference to undeclared input variable
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026