_This issue was originally opened by @kojiromike as hashicorp/terraform#10905. It was migrated here as part of the provider split. The original body of the issue is below._
0.8.2
Please list the resources as a list, for example:
```Error applying plan:
3 error(s) occurred:
If tf is trying to destroy instances, and those instances don't exist, this should not be a fatal error.
TF halted after it couldn't destroy the nonexistent deposed instances.
I am experiencing this same thing with aws_nat_gateway resources which no longer exists. After failing to delete the non-existent NAT resource it times out.
* aws_nat_gateway.nat.1 (deposed #0): Error waiting for NAT Gateway (nat-0a6dd2ef5cdc789f8) to delete: %!s(<nil>)
* module.network.module.private_subnet.aws_route_table.private[1]: 1 error(s) occurred:
And same with aws_ami
and aws_ami_from_instance
resources.
I struggled over what the work-around is for this. A state refresh doesn't help. I finally did a state list to get the exact name of the instance in the state and then did a state rm (remove) for that instance and could finally move on.
+1
This state happens when tf fails on a missing ssh keypair
Error: Error applying plan:
1 error(s) occurred:
* aws_instance.ecs: 1 error(s) occurred:
* aws_instance.ecs: Error launching source instance: InvalidKeyPair.NotFound: The key pair 'invalid-keypair-name' does not exist
status code: 400, request id: 2516997c-6384-4d95-8262-7c5333e3b3fb
causes a
Error: Error applying plan:
1 error(s) occurred:
* aws_instance.ecs: 1 error(s) occurred:
* aws_instance.ecs: InvalidInstanceID.NotFound: The instance ID 'i-061782cf8f1e068d9' does not exist
status code: 400, request id: a16464ff-d296-4b88-ab19-d53388dc703f
on the next terraform apply
+1
getting same issue while terraform apply. gettimg error that instance does not exist.
+1
thanks @practicalint that worked for me:
$ terraform state ls
...
$ terraform state rm google_compute_image.ubuntu
+1 this issue is still present in 0.11
@practicalint @matti Removing the state may cause other problems if you already created the new resource.
I have changed the state file:
terraform state pull > temp.state
Cleared deposed section,
do a vi temp.state
so changed this
"deposed": [
{
"id": "YOUR_ID_*************************",
"attributes": {
.........................................................
.........................................................
.........................................................
}
],
to this:
"deposed": [],
finally pushed the state
terraform state push temp.state
It fixed the deposed problem with no side effect
The fix for the original issue of the aws_instance
resource returning the Error terminating instance: InvalidInstanceID.NotFound
error has been merged and will release with version 1.55.0 of the Terraform AWS provider, likely in the next two days.
For issues with other resources or error messages, please open new issues filling out the issue template so we can properly triage. Thanks!
The fix for the original issue has been released in version 1.55.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
next
I also have the same issue InvalidInstanceID.NotFound: The instance ID 'i-XXXXXX' does not exist
Terraform v0.11.10
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
I struggled over what the work-around is for this. A state refresh doesn't help. I finally did a state list to get the exact name of the instance in the state and then did a state rm (remove) for that instance and could finally move on.