Skip to main content
Version: 5.16.0

Destroy an EKS Cluster

The infrastructure for a cluster can be destroyed by initializing your Terragrunt environment and then running terragrunt run-all destroy. See the Create an EKS Cluster documentation for more detailed information on how to initialize your Terragrunt environment, but an example execution might look like the following:

cd REPO_PATH
export TF_PLUGIN_CACHE_DIR="$(pwd)/.terragrunt-cache/providers/"
export TERRAGRUNT_ENV_FILE="$(pwd)/infra-iac/envs/your-custom-env.hcl"
export WORKSPACE_NAME="your-workspace-name"
cd infra
terragrunt run-all init
terragrunt run-all workspace select $WORKSPACE_NAME
terragrunt run-all destroy
terragrunt run-all workspace select default
terragrunt run-all workspace delete $WORKSPACE_NAME

If a cluster was initially deployed as a long-lived cluster, it may have the "persistent" flag enabled. This will prevent certain resources from being deleted by Terragrunt unless the flag is removed. For example, the "persistent" flag will enable deletion protection on RDS databases and will protect the S3 bucket used for access logging from deletion. Verify whether your cluster has been deployed with the "persistent" flag by checking the configured options in your env.hcl file.