Don't require AWS_ROLE_SESSION_NAME to sts:AssumeRoleWithWebIdentity (#9416)

Fixes #9415

Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>
This commit is contained in:
Ori Rawlings
2020-07-14 01:31:49 -05:00
committed by GitHub
parent 1c8263c180
commit 95e05e5642

View File

@@ -62,7 +62,7 @@ func (c *CredentialsConfig) GenerateCredentialChain() (*credentials.Credentials,
roleARN := os.Getenv("AWS_ROLE_ARN")
tokenPath := os.Getenv("AWS_WEB_IDENTITY_TOKEN_FILE")
sessionName := os.Getenv("AWS_ROLE_SESSION_NAME")
if roleARN != "" && tokenPath != "" && sessionName != "" {
if roleARN != "" && tokenPath != "" {
// this session is only created to create the WebIdentityRoleProvider, as the env variables are already there
// this automatically assumes the role, but the provider needs to be added to the chain
sess, err := session.NewSession()