'How to make terraform delete an EKS cluster including the AWS resources created by kubernetes?

I use terraform to create an environment in AWS. The environment also contains a EKS cluster, which integrates in AWS and creates some resources there. (For example an ingress will create an application load balancer or a route 53 record. Or a pvc will create a volume.)

What is a good way to make terraform destroy also delete all those depending resources?

Right now I only see destroy time provisioners with some ugly shell scripts.

Is there a more elegant way?



Solution 1:[1]

If you use modules like https://github.com/DNXLabs/terraform-aws-eks-lb-controller for ALBs

And terraform modules for the ingresses along with defining your route 53 records in terraform. It will be able to handle this.

Essentially you have to define all that in terraform or use destroy time provisioners to clean it up.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jim Leonard