• MacOS
  • AWS EKS using the Hashicorp sponsored module

There are times where a terraform destroy fails in Terraform Cloud or a local destroy.

These instructions assume you have nothing but EKS resources in your codebase.

Enter, manually deleting everything by hand; you’re encountering bugs (maybe).

(You can use the state as a reference for things you can’t find or aren’t obvious)

terraform state list is your source of truth in these operations.

  • Delete the EKS cluster node group
  • Delete the EKS cluster
  • Follow up with IAM roles & policies that are leftover that EKS didn’t clean up
  • Delete the elastic load balancers attached to the network interfaces.
  • Delete any remaining dependencies of the VPC to fire it into the sun.

After that, look over the state file and make sure there’s nothing left.

Then run something of this variation in a

while read -r assets; do terraform state rm $assets; done < <(terraform state list)

You should have an empty state file after these steps. If you are scared of these operations or have questions, please ping me. I give free advice.