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

Support for custom endpoints #371

Merged
merged 5 commits into from
Nov 29, 2019

Conversation

hmalphettes
Copy link
Contributor

This patch provides the ability to use aws-nuke against non default AWS endpoint.
Terraform's aws provider supports custom endpoints here: https://www.terraform.io/docs/providers/aws/guides/custom-service-endpoints.html

It could be used for integration testing pointing at "local stack".
In my case, I am pointing aws-nuke at Stratoscale clusters.

I am not very happy with the current implementation in this PR, although it does work for our use case.

  • defining new AWS partition does not really seem to be possible (let me know if I missed something)
  • terraform's implementation is directly at the session level for each service type: https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/config.go
  • the patch will either make a session for each service type of a region where custom endpoints are defined or it will fall back to use the standard mechanism.
  • for my usecase, there is no support for account aliasing, so I do detect that and present a prompt where the identifier of the region needs to be entered as if it was on of the aliases

If it is useful for the community let me know. Happy to refactor according to your guidance and in any case, thanks again for very useful tool.

@hmalphettes hmalphettes requested a review from a team May 19, 2019 09:30
@svenwltr
Copy link
Member

Hello @hmalphettes. Thanks for your contribution. Is there an easy way to test this? I have concerns that we might break this feature in future commits, if we simply cannot verify it.

@hmalphettes
Copy link
Contributor Author

hmalphettes commented May 22, 2019

Hi @svenwltr - I am not really sure actually.
Terraform actually documents - https://www.terraform.io/docs/providers/aws/guides/custom-service-endpoints.html:

NOTE: Support for connecting the Terraform AWS Provider with custom endpoints and AWS compatible solutions is offered as best effort. Individual Terraform resources may require compatibility updates to work in certain environments. Integration testing by HashiCorp during provider changes is exclusively done against default AWS endpoints at this time.

I actually don't have an AWS account active at the moment.

We could definitely test scanning an AWS account using the default mechanism and using the custom endpoints: as long as we get the same list of resources back, I think we are good to go.

If this makes sense, I'll add an example configuration for that.

@svenwltr
Copy link
Member

@hmalphettes This would be fine for me, if we add a note to the README, that endpoints are only supported as best effort and having an this example.

@svenwltr svenwltr added the status/waiting-reponse Waiting for the issue author to respond to a question. label Oct 10, 2019
@hmalphettes
Copy link
Contributor Author

Hi @svenwltr and sorry for dropping the ball for so long.
I was content enough for my own use.
The engineers of Stratoscale are using the custom endpoints found on this PR.
Would you still consider merging this and let -me- us know what would be missing?
Thanks a lot!

@romfreiman
Copy link

@hmalphettes lets rename demo10 to stratoscale :)

The custom endpoints support was tested against a stratoscale
demo cluster.
@svenwltr
Copy link
Member

@rebuy-de/prp-aws-nuke Please review.

Copy link
Member

@der-eismann der-eismann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some doc and formatting issues from me 🙂

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
cmd/root.go Outdated Show resolved Hide resolved
pkg/awsutil/session.go Outdated Show resolved Hide resolved
@bjoernhaeuser bjoernhaeuser merged commit c4d7e96 into rebuy-de:master Nov 29, 2019
@bjoernhaeuser
Copy link
Member

@hmalphettes thank you very much for the contribution, will be in the next release. <3

@svenwltr svenwltr added kind/enhancement New core feature or improvement of existing ones. and removed status/waiting-reponse Waiting for the issue author to respond to a question. labels Jan 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/enhancement New core feature or improvement of existing ones.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants