This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
Add another layer to the cache to keep regions separated #454
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.
This fix corrects an issue where the nuker does not correctly handle resources from multiple regions in a single run.
Currently, the nuker logic, specifically in the
HandleWait
function, is as follows:The flaw in this design is that the
item.List()
, called in step 2 above, only lists items for a single region (assuming the resource is region specific). Because of this, the cache will not be accurate for any region outside of the region that the item was in.Consider the following scenario, nuker runs on two regions: us-east-1 and us-east-2. us-east-1 has a single VPC and us-east-2 has a VPC with dependencies that cannot be deleted.
Because of this, I was getting errors very similar to the following where the debug clearly shows a 400 response from AWS but the nuker thinks the resource has been removed because of the incorrect cache.
My fix was to simply add another layer onto the cache and have all cached items reside in their respective region. The following is the result of the cache structure after my fix: