This action deletes all cloudformation xx/pr stacks in the provided region with the given name prefix + the stage suffix.
The stage is transformed from the branch name (eg. #85-my-feature
> xx85
/ pr85
). Production branch (master
| main
) branch
is always ignored.
Make sure your CloudFormation Stacks are fully deletable (if autoDeleteBuckets=true also autoDeleteItems, etc.)
Required string
The prefix of the stack names to delete.
Optional boolean
Whether the action should wait until the stack is completely deleted (status=DELETE_COMPLETE
).
Optional JSON String Array
branches to ignore (early exit, necessary since on-delete workflows do not support branch restrictions).
Production branches (master
| main
) branch is always ignored.
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: 'arn:aws:iam::{ACCOUNT_ID}:role/{ROLE_NAME}'
aws-region: eu-central-1
- name: Delete Stacks
uses: shiftcode/[email protected]
with:
stackNamePrefix: 'ch-website'
waitForDeleteComplete: true
# master & main are ignored by default
ignoreBranches: '["#1-dev"]'
- If there are stacks in multiple regions: use both actions two times with their corresponding region.
- If working with
assumedRoles
andaws-actions/configure-aws-credentials@v1
the policy statement for the static iam user needs to have the actions"sts:AssumeRole
ANDsts:TagSession
allowed on the role to assume. The Trust relationship of the assumed role needs to allow those actions for the assuming user.
To test the action locally: call index.js
with env var INPUT_STACKNAMEPREFIX
--> INPUT_STACKNAMEPREFIX="bag-covid19" node ./dist/index.js
- implement your changes
- commit with
npx commit
- set tag
git tag -a -m "my fancy release" v0.0.X
- push with tags
git push --follow-tags