Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Cleans old CloudFormation stacks, e.g. from CI runs

License

Notifications You must be signed in to change notification settings

bifravst/cloudformation-cleaner

🚚 moved to https://github.com/NordicSemiconductor/cloud-aws-cloudformation-cleaner-js
ℹ️ more info

AWS CloudFormation Cleaner

GitHub Actions Known Vulnerabilities semantic-release Renovate Mergify Status Commitizen friendly code style: prettier ESLint: TypeScript

This is a CDK project written in TypeScript that sets up a CloudFormation stack which cleans up left-over stacks from CI runs.

Although your CI tests should clean up after themselves, there still might be stacks that get not cleaned up perfectly. This stack runs a lambda every hour, which deletes stacks that have a certain prefix and are older than 24 hours.

Install

git clone https://github.com/bifravst/cloudformation-cleaner
npm ci

Setup in your CI account

Note: you should only set this up in an account where every CloudFormation stack can be deleted, because this lambda has the permissions to delete everything.

npx cdk deploy

You can configure the regular expression used to check against a stack name with the environment STACK_NAME_REGEX variable of the lambda, e.g. ^bifravst-.