Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Support for TGW Attachment Peering resources #996

Merged
merged 2 commits into from
Aug 2, 2023

Conversation

alemuro
Copy link
Contributor

@alemuro alemuro commented May 9, 2023

Hello!

This PR is for adding support to remove TGW Attachment Peering resources, as for now only VPC attachments are supported.

I thought about creating a couple of functions, one for "VPC" resources, and another for "Peering", but I didn't wanted to touch too many code unless it is strictly required.

If you want me to perform more changes please let me know.

Thanks!

Evidence

Before this change, any Nuke execution failed when trying to remove a TGW Attachment "peering" resource using the VPC removal API:

$ dist/aws-nuke -c <redacted>/aws-nuke/_ci/build/aws-nuke/config.yml --force-sleep 3 -t EC2TGWAttachment --max-wait-retries 10 -q --no-dry-run

aws-nuke version 58736c8 - Tue May  9 16:01:56 CEST 2023 - 58736c8eb2778a345bc28fc0735a492550abab79

Do you really want to nuke the account with the ID <redacted> and the alias 'default'?
Waiting 3s before continuing.
eu-central-1 - EC2TGWAttachment - tgw-attach-061234563367abcde(peering) - [ID: "tgw-attach-061234563367abcde"] - would remove
eu-central-1 - EC2TGWAttachment - tgw-attach-071234567890efghi(peering) - [ID: "tgw-attach-071234567890efghi"] - would remove
Scan complete: 12 total, 2 nukeable, 10 filtered.

Do you really want to nuke these resources on the account with the ID <redacted> and the alias 'default'?
Waiting 3s before continuing.
eu-central-1 - EC2TGWAttachment - tgw-attach-061234563367abcde(peering) - [ID: "tgw-attach-061234563367abcde"] - failed
eu-central-1 - EC2TGWAttachment - tgw-attach-071234567890efghi(peering) - [ID: "tgw-attach-071234567890efghi"] - failed

Removal requested: 0 waiting, 2 failed, 10 skipped, 0 finished

eu-central-1 - EC2TGWAttachment - tgw-attach-061234563367abcde(peering) - [ID: "tgw-attach-061234563367abcde"] - failed
eu-central-1 - EC2TGWAttachment - tgw-attach-071234567890efghi(peering) - [ID: "tgw-attach-071234567890efghi"] - failed

Removal requested: 0 waiting, 2 failed, 10 skipped, 0 finished

After this change, it works as expected, and the resources are being deleted 🎉

$ dist/aws-nuke -c <redacted>/aws-nuke/_ci/build/aws-nuke/config.yml --force --force-sleep 3 -t EC2TGWAttachment --max-wait-retries 10 -q --no-dry-run
aws-nuke version 58736c8.dirty - Tue May  9 16:12:06 CEST 2023 - 58736c8eb2778a345bc28fc0735a492550abab79

Do you really want to nuke the account with the ID <redacted> and the alias 'default'?
Waiting 3s before continuing.
eu-central-1 - EC2TGWAttachment - tgw-attach-061234563367abcde(peering) - [ID: "tgw-attach-061234563367abcde"] - would remove
eu-central-1 - EC2TGWAttachment - tgw-attach-071234567890efghi(peering) - [ID: "tgw-attach-071234567890efghi"] - would remove
Scan complete: 12 total, 2 nukeable, 10 filtered.

Do you really want to nuke these resources on the account with the ID <redacted> and the alias 'default'?
Waiting 3s before continuing.
eu-central-1 - EC2TGWAttachment - tgw-attach-061234563367abcde(peering) - [ID: "tgw-attach-061234563367abcde"] - triggered remove
eu-central-1 - EC2TGWAttachment - tgw-attach-071234567890efghi(peering) - [ID: "tgw-attach-071234567890efghi"] - triggered remove

Removal requested: 2 waiting, 0 failed, 10 skipped, 0 finished

eu-central-1 - EC2TGWAttachment - tgw-attach-061234563367abcde(peering) - [ID: "tgw-attach-061234563367abcde"] - waiting
eu-central-1 - EC2TGWAttachment - tgw-attach-071234567890efghi(peering) - [ID: "tgw-attach-071234567890efghi"] - waiting

Removal requested: 2 waiting, 0 failed, 10 skipped, 0 finished

@alemuro alemuro requested a review from a team as a code owner May 9, 2023 14:27
@alemuro alemuro force-pushed the support-tgw-attachment-peering branch from bafb7c9 to 2e1c2ff Compare June 6, 2023 07:09
Support for removing TGW Attachment Peering resources, as only VPC attachments
where supported before.
@alemuro alemuro force-pushed the support-tgw-attachment-peering branch from 2e1c2ff to b0d033f Compare July 11, 2023 14:06
@bjoernhaeuser bjoernhaeuser enabled auto-merge (squash) August 2, 2023 08:24
@bjoernhaeuser bjoernhaeuser merged commit 529f885 into rebuy-de:main Aug 2, 2023
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants