jaxxstorm / aws-sso-creds

Get AWS SSO temporary creds from an SSO profile
MIT License
182 stars 24 forks source link

Broken export in 1.5.0 #53

Open agusl88 opened 5 months ago

agusl88 commented 5 months ago

Since version 1.5.0, the export option it's not working. This exact command & config file was working fine before 1.5.0

~ aws-sso-creds --profile default export                                                                                                                                                                                <aws:default>
Error: error retrieving SSO config: unable to find profile: <default>

config file

[profile default]
sso_session = mycompany
sso_account_id = XXXXXXXX
sso_role_name = MyRole
sso_start_url = https://d-XXXXX.awsapps.com/start/#/
sso_region = us-east-1
[sso-session mycompany]
sso_start_url = https://d-XXXXX.awsapps.com/start/#/
sso_region = us-east-1
sso_registration_scopes = sso:account:access
sso_role_name = MyRole
jaxxstorm commented 5 months ago

I'm unable to repro this locally:

[sso-session personal]
sso_region = us-west-2
sso_start_url = https://<redacted>.awsapps.com/start

[profile personal-development]
sso_session = personal
output = json
region = us-west-2
sso_account_id = <redacted>
sso_role_name = AWSAdministratorAccess
sso_start_url = https://<redacted>.awsapps.com/start
sso_region = us-west-2

[profile personal-management]
sso_region = us-west-2
output = json
region = us-west-2
sso_account_id = <redacted>
sso_role_name = AWSAdministratorAccess

[profile personal-production]
sso_session = personal
output = json
region = us-west-2
sso_account_id = <redacted>
sso_role_name = AWSAdministratorAccess
agusl88 commented 5 months ago

Probably because the example you are using it's not representative of the issue, that's why i included my config file.

Did some further testing, and the problem seems to be present only when the profile is named default, which makes sense since the code has some edge cases for it

jaxxstorm commented 5 months ago

Probably because the example you are using it's not representative of the issue

Yes, I am aware of this. Thanks for the explanation though.

I will accept a PR if you can figure out the issue.