-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use RemoteCredProvider instead of EC2RoleProvider #2983
Conversation
…S and other cases
@joelthompson It's not letting me request a review from you but can you take a look? |
@jefferai -- this generally seems fine (modulo the compile error from Travis), but I don't have too much experience with the golang SDK. I would suggest updating the documentation to reflect these changes, i.e.:
There's some more cleanup work that could be done to make things more consistent, e.g., move the DynamoDB physical backend to use the credential helper, as it won't pick up creds from ECS tasks, be consistent about using AWS_REGION and AWS_DEFAULT_REGION environment variables, and make AWS_REGION take precedence over AWS_DEFAULT_REGION which is what the golang SDK does -- though that's a small a breaking change. But, I'd suggest just getting this fix in now for the next release, and potentially do the cleanup work later. |
I didn't even see AWS_DEFAULT_REGION in the sdk, I thought that was something Vault-specific. Anyways, I've updated with your feedback, except for updating the docs. Can you take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make sense to factor out the region environment variable checking since it's repeated in a few places.
I didn't even see AWS_DEFAULT_REGION in the sdk, I thought that was something Vault-specific.
See, e.g., this
@@ -31,7 +32,10 @@ func getRootConfig(s logical.Storage) (*aws.Config, error) { | |||
} | |||
|
|||
if credsConfig.Region == "" { | |||
credsConfig.Region = "us-east-1" | |||
credsConfig.Region = os.Getenv("AWS_REGION") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you also want to check AWS_DEFAULT_REGION here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -35,10 +35,11 @@ storage "s3" { | |||
|
|||
- `endpoint` `(string: "")` – Specifies an alternative, AWS compatible, S3 | |||
endpoint. This can also be provided via the environment variable | |||
`AWS_DEFAULT_REGION`. | |||
`AWS_S3_ENDPOINT`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this incorrect before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Looks like it was copypasta. The code actually uses AWS_S3_ENDPOINT though.
This better handles ECS and other future use-cases.