Error reading resource: not found (deleted outside Terraform) Terraform Origin: Platform & cloud OSI layer 7 · Application Last updated 5 Nov 2026

Terraform: Error: reading EC2 Instance (i-0abc): couldn't find resource / 404 ResourceNotFound during refresh

A resource tracked in state no longer exists in the cloud (deleted manually) or can't be read with current credentials.

Exact message you may see Error: reading EC2 Instance (i-0abc): couldn't find resourceError: Error reading resource: 404 Not FoundError: reading resource: ResourceNotFoundExceptionError: error reading: NotFound: Not Found status code: 404Error: reading Resource Group: ResourceGroupNotFound
Seen on: Terraform

Meaning

Most providers remove missing resources from state automatically on refresh; some error. Check you're using the right account/region/credentials, then terraform apply -refresh-only or terraform state rm ADDRESS to forget it, or recreate it with terraform apply. Permission errors can look like "not found" for some APIs.

Common causes

  • Resource deleted manually
  • Wrong credentials/region (can't see it)
  • Resource moved to another project/subscription
  • Eventually consistent API
  • Provider bug on a deleted parent

⚡ Quick fix

  1. Verify with the cloud CLI/console
  2. terraform apply -refresh-only to reconcile
  3. terraform state rm ADDRESS to drop it if intentionally gone

Detailed fix by platform

Terraform

  1. terraform state list | grep web && terraform state rm aws_instance.web

How to diagnose

  1. Exists — In the cloud?
  2. Identity — Right account?
  3. Action — Recreate or forget?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

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 (Terraform)Cannot import non-exi…Error acquiring the state lock — Terraform: Error: Error acquiring the state lock — ConditionalCheckFailedException / state blob is already locked (Terraform)Error acquiring the s…Error building ARM Config: obtain subscription from Azure CLI — Terraform: Error: building AzureRM Client: obtaining subscription ID / Please run 'az login' to setup account (Terraform)Error building ARM Co…Invalid AWS Region — Terraform: Error: Invalid AWS Region: us-east-3 / Error: configuring Terraform AWS Provider: validating provider credentials: operation error STS: GetCallerIdentity (Terraform)Invalid AWS RegionInvalid target address / No matching objects found (state commands) — Terraform: Error: Invalid target address — No matching objects found. To view the available instances, use "terraform state list" (Terraform)Invalid target addres…No valid credential sources found (AWS provider) — Terraform: Error: No valid credential sources found — failed to refresh cached credentials, no EC2 IMDS role found / Error: configuring Terraform AWS Provider: no valid credential sources (Terraform)No valid credential s…Provider produced inconsistent result after apply — Terraform: Error: Provider produced inconsistent result after apply — When applying changes to aws_x.y, provider produced an unexpected new value: Root resource was present, but now absent (Terraform)Provider produced inc…UnauthorizedOperation / AccessDenied during Terraform apply — Terraform: Error: creating EC2 Instance: UnauthorizedOperation: You are not authorized to perform this operation. User: arn:aws:iam::123:user/ci is not authorized to perform: ec2:RunInstances (Terraform)UnauthorizedOperation…Error rea…

Explore the map of this error Full error map →

🧠 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.