trek10inc / awsume

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

.aws/config only updates when the default profile is at the top #38

Closed froocpu closed 5 years ago

froocpu commented 6 years ago

After installing awsume for the first time, auto-refresh credentials are only generated if the config files has the [default] profile at the beginning. For example:

awsume [name_of_profile] -a

This will fail silently when the aws config file looks something like this:

[name of profile]
...
[default]
...

But it will succeed when the two are reversed:

[default]
...
[name_of_profile]
...
mbarneyjr commented 6 years ago

Hi @froocpu, I'm struggling to reproduce this problem, but I want to make sure I understand it clearly too.

So you're trying to use awsume's auto-refresher on the profile name_of_profile (which I assume is a role profile - it's config section has a role_arn and a source_profile).

When the default profile is not at the top, other profiles are on top of it in the file, this causes the execution of awsume name_of_profile -a to do what exactly? Does it not put the credentials into a [auto-refresh-name_of_profile] profile in the ~/.aws/credentials file? Or does it fail to set your environment variables to something like this:

  AWSUME_PROFILE=name_of_profile
  AWS_PROFILE=auto-refresh-name_of_profile
  AWS_DEFAULT_PROFILE=auto-refresh-name_of_profile

Or does it fail to do both? Also, could you provide the exact output of what your terminal says when you execute awsume name_of_profile -a, and the output of awsume name_of_profile -a --debug (Please redact any of your credentials from the output).

mbarneyjr commented 5 years ago

Closing for inactivity