terraform icon indicating copy to clipboard operation
terraform copied to clipboard

Terraform Destroy EKS cluster with vpc,subnets & internet gateway

Open saikrishna2733 opened this issue 3 years ago • 2 comments

Terraform Version

Terraform v1.0.5

Terraform Configuration Files

Repo: https://github.com/saikrishna2733/terraform-aws-eks/
Branch : CICD

Debug Output

Crash Output

Repo: https://github.com/saikrishna2733/terraform-aws-eks/ Branch : tf-bug1

Expected Behavior

When the user destroys the resources using the terraform destroy command it should delete the resources.

Actual Behavior

It is unable to destroy some of the resources because in the process of eks cluster creation using terraform & Helm, it is creating a load balancer resource which is depending on some of the resources and is not getting updated in the terraform state. Hence, Terraform is unable to delete some of the resources,

Steps to Reproduce

Additional Context

Issue story Resources that am creating using terraform are as follows. 1.VPC 2. Subnets, 3. Internet gateway 4. security hub 5. EKS cluster 6. EKS node group 7. IAM roles 8. code commit 9. code build 10. code pipeline 11. ECR 12. any other dependent for the above services.

I have created the EKS cluster and I have deployed my sample images into the cluster manually and used it for some time and when i tried to destroy all the resources, some of the network-related resources are not getting deleted. Because, when we deploy a sample image into the cluster, it is creating one load balancer which is acting as a service for the pod or deployment.

I can replicate this issue, please let me know your comments on this. In case of any queries, please feel comfortable reaching out to me.

References

saikrishna2733 avatar Aug 25 '21 11:08 saikrishna2733

Hi @saikrishna2733,

I found the file in your branch representing the error message but the file seems to be empty. Did you intend to include some content in that file?

apparentlymart avatar Aug 26 '21 00:08 apparentlymart

If EKS deploys ALBs into either of your subnets then yeah, Terraform or even AWS CLI will not be able to delete neither ALBs or subnets.

ALBs because, well, they're not managed by Terraform. Subnets because there are ENIs allocated from the ALBs.

This isn't a bug in Terraform but rather how AWS works.

anarsen avatar Sep 07 '21 19:09 anarsen

Hello all, I'm cleaning up old issues and I see this one did not receive a response. I am going to close this issue now, please let me know if you believe this action to be taken in error. Thanks!

crw avatar Oct 25 '23 23:10 crw

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Dec 07 '23 02:12 github-actions[bot]