File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,17 @@ if [ ${#targets[@]} -gt 0 ]; then
8181fi
8282
8383
84+ # # Destroy EKS resources before VPC to ensure NAT gateway and VPC endpoints
85+ # # remain available while nodes drain
86+ echo " Destroying EKS resources first (preserving VPC for pod cleanup)..."
87+ destroy_output=$( $TERRAFORM_COMMAND -var=" region=$REGION " -target=module.eks 2>&1 | tee /dev/tty)
88+ if [[ ${PIPESTATUS[0]} -eq 0 && $destroy_output == * " Destroy complete" * ]]; then
89+ echo " SUCCESS: EKS resources destroyed"
90+ else
91+ echo " FAILED: EKS destroy failed"
92+ exit 1
93+ fi
94+
8495# # Final destroy to catch any remaining resources
8596echo " Destroying remaining resources..."
8697destroy_output=$( $TERRAFORM_COMMAND -var=" region=$REGION " 2>&1 | tee /dev/tty)
You can’t perform that action at this time.
0 commit comments