✨ Prepare janitor for initial version #4
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds new functionalities and refactors the rules for deletion:
ignore-tag
input parameter: name of the tag that indicates a resource should not be deleted. If not provided, it uses a sensible defaultjanitor-ignore
.ttl
is no longer used for deletion since janitor now manages deletion of resources that do not have a creation time associated with them. The new approach is mark and delete: the initial execution will mark (using tagaws-janitor/marked-for-deletion
) for future deletion on all resources that do not have an ignore tag. Next execution will apply deletion on marked resources.In some specific scenarios, intermittent failures may occur due to dependent resources but these should be fixed in subsequent iterations.
Comments
After this PR is merged, we'll need to add the janitor to the existing GitHub Action.
Deletion of Security Groups is required for VPC to be deleted from the CloudFormation stack. AWS seems to be slow to delete Security Groups and ingress/egress rules, which can make one Security Group dependent on another. Since there's no way in the SDK to wait for SGs to be deleted, there needs to be a
Sleep
added between triggered deletions. The number of SGs should always be manageable so this is not expected to noticeably affect time of execution.