common-fate / granted

The easiest way to access your cloud.
https://granted.dev
MIT License
964 stars 91 forks source link

--active-role option broken for SSO #539

Closed tigris closed 8 months ago

tigris commented 8 months ago

Since upgrading to a version with #467 in it, where the AWS ENV vars are not exported by default, I am unable to use the --active-role (or -ar) feature.

#-❯ assume -ar
[✘] one of the require environment variables was not found while loading an sso profile ['GRANTED_SSO_START_URL','GRANTED_SSO_REGION','GRANTED_SSO_ACCOUNT_ID','GRANTED_SSO_ROLE_NAME']

This is after I have done a successful assume where i can do other credential required things (such as aws s3 ls) and granted has put an AWS_PROFILE in my environment.

A snippet of my ~/.aws/confg looks like this:

[profile my-profile]
granted_sso_start_url      = https://my-sso.awsapps.com/start
granted_sso_region         = my-region
granted_sso_account_id     = my-account
granted_sso_role_name      = my-role
common_fate_generated_from = aws-sso
credential_process         = granted credential-process --profile my-profile

I'm not entirely sure if there is some config I'm missing, or if I'm supposed to run something extra with the regular assume to make it export the GRANTED_* variables that assume -ar wants?

shwethaumashanker commented 8 months ago

Hi @tigris, with v0.20.0, you will be able to add the configuration DefaultExportAllEnvVar=true to your ~/.granted/config. This should default to exporting all environment variables and the -ar flag should work ask before. Let me know if that works for you.