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

**Code:** `Error reading resource: not found (deleted outside Terraform)` · **Category:** Terraform · **Seen on:** Terraform

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/terraform/resource-not-found-error-reading-removed-outside)
