Skip to content

Commit

Permalink
chore: on eks cluster removal failure dump some vpc info (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
Langleu authored Feb 10, 2025
1 parent 70e75d9 commit df7724a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .github/actions/eks-cleanup-resources/scripts/destroy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,24 @@ destroy_resource() {
-var="region=$AWS_REGION" \
-var="name=$cluster_name" \
-var="cluster_service_ipv4_cidr=10.190.0.0/16" \
-var="cluster_node_ipv4_cidr=10.192.0.0/16"; then return 1; fi
-var="cluster_node_ipv4_cidr=10.192.0.0/16"; then
echo "Error destroying EKS cluster $cluster_name"
VPC_ID=$(terraform output -raw vpc_id)

export AWS_PAGER=""
echo "Checking subnetes for $VPC_ID"
aws ec2 describe-subnets --filters "Name=vpc-id,Values=$VPC_ID"
echo "Checking route tables for $VPC_ID"
aws ec2 describe-route-tables --filters "Name=vpc-id,Values=$VPC_ID"
echo "Checking internet gateways for $VPC_ID"
aws ec2 describe-internet-gateways --filters "Name=attachment.vpc-id,Values=$VPC_ID"
echo "Checking NAT gateways for $VPC_ID"
aws ec2 describe-nat-gateways --filter "Name=vpc-id,Values=$VPC_ID"
echo "Dumping elastic ips"
aws ec2 describe-addresses

return 1
fi

elif [ "$terraform_module" == "aurora" ]; then
if ! terraform destroy -auto-approve \
Expand Down

0 comments on commit df7724a

Please sign in to comment.