gruntwork-io/cloud-nuke

Unify AWS SDK versions

Closed this issue · 4 comments

We're currently leveraging at least two separate AWS SDK versions for listing / nuking. We should probably figure out a way to standardize on the latest and a reasonable means of updating these in the future.

At least, this is stymied by the fact that the different versions we're using have backward incompatible changes to the way the AWS Session itself is managed.

hey Zack, I was looking at this as I found the two AWS SDKs in use by the SNS functionality in my last PR. I suspect the complications for migration over time to AWS SDK v2 here come from the AWSResources interface with defines a session.Session as an argument and binds it to AWS SDK v1.

I did explore some options locally, but nothing felt like a clean solution to the problem. I was leaning toward each concrete Nuke function translate the session to aws.Config, then switch all the individual resource implementations over time, then redefine the Nuke function in the AWSResources interface to accept an aws.Config over a session.Session (or something like a ctx and region that can be used to construct an underlying session/config, without being tied to the specific type).

I also looked at making AWSResources generic over aws.Config and session.Session but I don't think that is possible as I ran into issues with instantiation on the AwsAccountResources type, via https://github.com/gruntwork-io/cloud-nuke/blob/master/aws/types.go#L85.

Open to any approach, and happy to pick up some of the work once the direction is paved.

Hey Rob,

Thanks for the detailed feedback and exploration. Your findings make sense to me.

Just a logistical note to say I'm no longer working at Gruntwork so probably won't get a chance to look at this anytime soon.

However, there's several talented Gruntworkers still maintaining this repo who could probably weigh in with their thoughts when they have some free cycles.

All the best,
Zack

Hey Zack

Thanks for circling back up on this issue, and wishing you the best of luck in your new endeavors!

As part of the unit test refactoring effort, I unified all the sdk to v1. Closing this as there are no further action required.