Skip to content

credential_process and sso_* options are mutually exclusive in AWS SDK for Go #23

@aidansteele

Description

@aidansteele

The AWS SDK for Go has the following lines:

func (cfg *sharedConfig) validateCredentialType() error {
	// Only one or no credential type can be defined.
	if !oneOrNone(
		len(cfg.SourceProfileName) != 0,
		len(cfg.CredentialSource) != 0,
		len(cfg.CredentialProcess) != 0,
		len(cfg.WebIdentityTokenFile) != 0,
		cfg.hasSSOConfiguration(),
	) {
		return ErrSharedConfigSourceCollision
	}


	return nil
}

https://github.com/aws/aws-sdk-go/blob/4a3fa399d8948450087b360a1d82e8298eb1c25c/aws/session/shared_config.go#L397-L410

Which doesn't play nicely with the generated profiles in ~/.aws/config:

[profile example]
sso_start_url = https://example.awsapps.com/start
sso_region = us-east-1
sso_account_id = 0123456789012
sso_role_name = example-role
region = us-east-1
credential_process = aws-sso-credential-process --profile example

Repro code:

package main

import (
	"github.com/aws/aws-sdk-go/aws/session"
)

func main() {
	_, err := session.NewSessionWithOptions(session.Options{
		Profile: "example",
		SharedConfigState: session.SharedConfigEnable,
	})
	if err != nil {
	    panic(err)
	}
}

I've only just started using this tool so I don't yet have a solution on how to best fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions