File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # The CI for this repo can sometimes leave some stacks lying around - every couple of months we need to clean them up.
4
+ # This script will delete any stacks that are in DELETE_FAILED state, that contain the word _test_ in their name, and
5
+ # that are not autoscaling stacks (these are child stacks that will be deleted when their parent is deleted)
6
+
7
+ set -euo pipefail
8
+
9
+ aws cloudformation list-stacks \
10
+ | jq -r " .StackSummaries[] | {StackName, StackStatus} | select(.StackStatus == \" DELETE_FAILED\" ).StackName" \
11
+ | grep test \
12
+ | grep -vi autoscaling \
13
+ | sort | uniq \
14
+ | xargs -t -I {} aws cloudformation delete-stack \
15
+ --stack-name {} \
16
+ --role-arn " $ROLE_ARN "
You can’t perform that action at this time.
0 commit comments