trek10inc / awsume

A utility for easily assuming AWS IAM roles from the command line.
https://awsu.me
MIT License
485 stars 90 forks source link

Awsume error: Invalid profile [abc] unsupported awsume credential_source profile option: abc #218

Closed vishnurpiper closed 1 year ago

vishnurpiper commented 1 year ago

Please find below my profile / credentials configuration

~/.aws/config [abc] region = us-east-1 credential_source = abc

~/.aws/credentials [abc] aws_access_key_id=blah aws_secret_access_key=blah aws_session_token=blah

I am a longtime awsume user and I've had success with awsume (configured with mfa). The company I work for moved to using IAM SSO so I am trying this setup with 'aws_session_token'.

Did some debugging and the error appears to be coming from profile.py - VALID_CREDENTIAL_SOURCES is [ None, 'Environment', 'Ec2InstanceMetadata', 'EcsContainer' ]

    if user_profile:
        missing_keys = []
        if 'credential_source' in profile:
            if profile.get('credential_source') not in VALID_CREDENTIAL_SOURCES:
                raise exceptions.InvalidProfileError(user_profile_name, message='unsupported awsume credential_source profile option: {}'.format(profile.get('credential_source')))
        elif not 'credential_process' in user_profile and not 'credential_process' in profile:
            if 'aws_access_key_id' not in user_profile:
                missing_keys.append('aws_access_key_id')
            if 'aws_secret_access_key' not in user_profile:
                missing_keys.append('aws_secret_access_key')
        if missing_keys:
            raise exceptions.InvalidProfileError(user_profile_name, message='Missing keys {}, or credential_source, or credential_process'.format(', '.join(missing_keys)))

    return True

What am I missing? I am currently using awsume version 4.5.3

vishnurpiper commented 1 year ago

Wrong usage of credential_source. All good, will close issue.