Skip to content
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

Skip keypair delete when lack permissions #26

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

rukai
Copy link
Member

@rukai rukai commented Oct 26, 2023

Keypairs do not form any dependencies with other AWS resources nor do they cost anything, so they can be deleted or left behind without consequence.
The only reason to delete them is to keep the list of keypairs clean.
This is a noble goal but if the user we are given doesnt allow deletion then its better to just give up on deleting rather than fail.
But we should also avoid attempting to delete every throwaway keypair otherwise as more keypairs are created it will take longer and longer to run.
So this PR implements logic to give up on keypair deletion when we hit an UnauthorizedOperation error.

An alternative to this is to have keypair deletion as a config in the AwsBuilder but I would rather reduce the cognitive load of yet another config option.

@rukai rukai requested a review from conorbros October 26, 2023 00:21
@rukai rukai enabled auto-merge (squash) October 26, 2023 08:57
@rukai rukai merged commit 89f98b1 into shotover:main Oct 26, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants