Skip to content

handle stack deletion if the stack was never deleted before #517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion tests/tekton-resources/tasks/teardown/awscli-eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ spec:
# wait for the launch-template stack to be completely deleted to avoid race-conditions.
echo "waiting for launch-template stack deletion..."
aws cloudformation wait stack-delete-complete --stack-name $(params.launch-template-stack-name)
aws cloudformation delete-stack --stack-name $(params.node-role-stack-name) --deletion-mode FORCE_DELETE_STACK
STACK_STATUS=$(aws cloudformation describe-stacks --stack-name $(params.node-role-stack-name) --query 'Stacks[0].StackStatus' --output text || echo "STACK_NOT_FOUND")
echo $STACK_STATUS
if [ "$STACK_STATUS" == "DELETE_FAILED" ]; then
echo "Stack is in DELETE_FAILED state, using FORCE_DELETE_STACK"
aws cloudformation delete-stack --stack-name $(params.node-role-stack-name) --deletion-mode FORCE_DELETE_STACK
else
echo "Normal stack deletion"
aws cloudformation delete-stack --stack-name $(params.node-role-stack-name)
fi

- name: awscli-delete-vpc
image: alpine/k8s:1.23.7
Expand Down