-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Environment credential_source in shared config does not assume role #2385
Comments
Hi @alsmola, thanks for reaching out to us about this. I'm able to reproduce the behavior you're describing on my end, and can confirm that modifying the |
Any updates on this one? Thought I'd be able to use this feature in go-based utilities (terraform), and was surprised to find myself getting Unauthorized responses. |
Relevant changes: * backend/s3: Support for chaining assume IAM role from AWS shared configuration files * backend/s3: Fix AWS shared configuration file credential source not assuming a role with environment and ECS credentials References: * https://github.com/aws/aws-sdk-go/releases/tag/v1.20.0 * aws/aws-sdk-go#2579 * aws/aws-sdk-go#2385 Updated via: ```console $ go get github.com/aws/[email protected] $ go mod tidy $ go mod vendor ```
…fig (aws#2579) Adds support chaining assume role credentials from the shared config/credentials files. This change allows you to create an assume role chain of multiple levels of assumed IAM roles. The config profile the deepest in the chain must use static credentials, or `credential_source`. If the deepest profile doesn't have either of these the session will fail to load. Fixes the SDK's shared config credential source not assuming a role with environment and ECS credentials. EC2 credentials were already supported. Fix aws#2528 Fix aws#2385 Also adds the ability to specify the Handlers the SDK should use at the SessionWithOptions. This allows the a set of handlers to be provided at the very beginning of the session credential chain.
Using aws-sdk-go version 1.16.13
Using go 1.10.2
Issue
When specifying a profile in a shared AWS configuration file with the
credential_source
value set toEnvironment
, the credentials used are the environment variables as static credentials, rather than the assumed role credentials using the env vars. I've tested that the AWS CLI assumes the role correctly.Steps to reproduce
Create an AWS configuration file at
/home/user/.aws/config.test
with the following content:Use the
aws-sdk-go
with the following code:The resulting IAM ARN is the user associated with the environment variables, not the
role-test
IAM role.A small change to https://github.com/aws/aws-sdk-go/blob/master/aws/session/session.go#L497-L499 fixes the behavior and makes it consistent with the
Ec2Metadata
credential_source
behavior.The text was updated successfully, but these errors were encountered: