question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Destroy fails when AWS resources cannot be found

See original GitHub issue

When destroying a k8s cluster, if for some reason an AWS resource gets removed and Pulumi isn’t aware of it, it will ultimately cause the destroy to fail if it cannot find the resource:

$ pul destroy
Previewing destroy (eks-demo):

     Type                                  Name                      Plan
 -   pulumi:pulumi:Stack                   eks-hello-world-eks-demo  delete
 -   ├─ eks:index:Cluster                  helloWorld                delete
 -   │  ├─ pulumi-nodejs:dynamic:Resource  helloWorld-cfnStackName   delete
 -   │  ├─ eks:index:ServiceRole           helloWorld-eksRole        delete
 -   │  └─ eks:index:ServiceRole           helloWorld-instanceRole   delete
 -   └─ aws-infra:network:Network          vpc                       delete
 -      ├─ aws:ec2:InternetGateway         vpc                       delete
 -      ├─ aws:ec2:Eip                     vpc-nat-1                 delete
 -      ├─ aws:ec2:Eip                     vpc-nat-0                 delete
 -      └─ aws:ec2:Vpc                     vpc                       delete

Resources:
    - 10 to delete

Do you want to perform this destroy? yes
Destroying (eks-demo):

     Type                        Name                      Status                  Info
     pulumi:pulumi:Stack         eks-hello-world-eks-demo
 -   └─ aws:ec2:InternetGateway  vpc                       **deleting failed**     1 error

Diagnostics:
  aws:ec2:InternetGateway (vpc):
    error: Plan apply failed: deleting urn:pulumi:eks-demo::eks-hello-world::aws-infra:network:Network$aws:ec2/internetGateway:InternetGateway::vpc: Error waiting for internet gateway (igw-0305d3fc89e01176e) to detach: couldn't find resource (31 retries)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
lukehobancommented, Mar 28, 2019

Does pulumi refresh help in this case?

Is the scenario that the InternetGateway (or other resource) is manually deleted from AWS behind the scenes? If so, curious what is the desired/suggested behaviour in this case?

3reactions
lukehobancommented, May 28, 2019

I’m going to close this out - as I believe the original issue is expected, and requires that the user do pulumi refresh or pulumi state delete to reconcile their checkpoint with the cloud provider prior to pulumi destroy.

https://github.com/pulumi/pulumi/issues/2247 is tracking doing a refresh automatically prior to preview/update/destroy. That would be the only thing that could fundamentally “solve” the original issue here.

The other issues referenced along the way sound like unrelated potential bugs, but there are not details on repro steps for those here. Let’s open new issues on those if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Destroy AWS resources of a failed/canceled Terraform apply
I did a quick test and even terraform apply failed in the middle, it still keeps completed resources in terraform.tfstate. File main.tf
Read more >
Resource manually deleted, now cant Destroy, Plan or ...
Hello, we have an unfortunate situation where a user deleted an AWS resource which should have been locked, and now we want to...
Read more >
Troubleshooting common AWS CDK issues
When deploying my AWS CDK stack, I receive a NoSuchBucket error ... My S3 bucket, DynamoDB table, or other resource is not deleted...
Read more >
How to troubleshoot 5 common Terraform errors
Terraform may destroy or change existing resources if your state is out of ... terraform validate Error: Missing resource instance key on ...
Read more >
aws_iam_user | Resources | hashicorp/aws
The aws_iam_user_policy_attachment resource (recommended) does not have this ... will fail to be destroyed. tags - Key-value map of tags for the IAM...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found