gruntwork-io/cloud-nuke

introducting AWS SDK v2 + add support for managed prometheus

wakeful opened this issue · 0 comments

the issue

cloud-nuke is currently using an outdated version of the Go SDK. AWS SDK v1 has been officially deprecated. More information here.

what's expected

We should consider and plan an upgrade path to SDK v2.

my approach

Recently, I aimed to add support for Managed Prometheus. However, this resource is only supported in SDK v2. To minimise the impact of the change set, I decided to extend the AwsResource interface with two new methods.

type AwsResource interface {
	InitV2(cfg awsgoV2.Config)
	IsUsingV2() bool
}

the BaseAwsResource was also extend to define a default behaviour

func (br *BaseAwsResource) IsUsingV2() bool {
	return false
}

with above in place I was able to extend the initRegisteredResources to configure SDK v2 client using the existing Session.

this allowed me to implement a new resource from SDK v2.

Question for Maintainers

What are your thoughts on adding support for SDK v2? I would appreciate your feedback on my proposed solution and welcome any comments! PR related to this change.