A resource was deleted manually in the console. The plan wants to create it, and an apply fails because a dependent resource still references the old ID.
IntermediateTroubleshootingLost, Corrupted and Drifted State
Answer
Likely causes → Refresh noticed the object is gone and planned a create, but dependents (route table association, target group attachment) were not updated in the same plan because their attributes didn't appear to change.
Diagnose → terraform plan shows + create for the deleted resource, and dependents show no change or known after apply IDs.
Fix → Usually one apply resolves it; if dependents still point at the old ID, force them to be recreated:
terraform apply -replace='aws_route_table_association.private["a"]'
Prevent → Restrict delete permissions in prod; use prevent_destroy on critical resources so even Terraform won't remove them without a code change.
More on Lost, Corrupted and Drifted State
Someone deleted the state object from the S3 bucket. `terraform plan` now wants to create 140 resources that already exist.IntermediateState is gone and the bucket had no versioning. How do you recover a production stack?Advanced`Error: Failed to load state` followed by a JSON error like `invalid character '}' looking for beginning of object key string`.IntermediateThe plan prints `Note: Objects have changed outside of Terraform` and lists a security group with an extra ingress rule.BeginnerEvery plan wants to change `desired_capacity` on an Auto Scaling group back to 2, though autoscaling has raised it to 6.Beginner`terraform plan -refresh-only` shows drift, and you apply it. The next normal plan still wants to revert the change. Why?Intermediate