Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support refresh (by default, with opt-out) for print and write #179

Open
dougmoscrop opened this issue Aug 13, 2019 · 2 comments
Open

Support refresh (by default, with opt-out) for print and write #179

dougmoscrop opened this issue Aug 13, 2019 · 2 comments

Comments

@dougmoscrop
Copy link

dougmoscrop commented Aug 13, 2019

bmx renew did not survive the rewrite from python to golang I think it would be useful to support it.

Example:

bmx renew --profile=test-foo

Renew would:

  • check if the given profile exists
  • if it does, move on to checking if the credentials are still valid
    -- if the credentials are valid, done
    -- if expired, then refresh the credentials using the previously used account and role, which may or may not prompt for a password/code
  • if it does not, act like bmx write

--profile would default to $AWS_PROFILE if unspecified, allowing users to export AWS_PROFILE=xyz and just bmx renew (all bmx commands should understand and respect AWS_PROFILE in my opinion). I would also argue that renew should be a profile-only command, and I actually completely discourage using default credentials anywhere

@chris-redekop
Copy link

From your description, I think a --refresh option on both write and print would make sense and be useful. Did I get that right?

@dougmoscrop
Copy link
Author

dougmoscrop commented Aug 16, 2019

Yeah, although I think further to your point, --refresh should just be the default behaviour!

Or said, "As a developer, I want to type as few things as possible" 😆

bmx [write|print] should:

  1. take $AWS_PROFILE if set
  2. override that with --profile when provided and fall back to 'default' profile if AWS_PROFILE and --profile are not provided
  3. look to see what account/role was used for {resolved-profile}, if profile is being specified
  4. see if the credentials are expired, and refresh them if necessary, this should only prompt for account/role if default profile was used, or no pre-existing profile-to-account-and-role mapping exists, or --no-refresh is set
  5. write or print them depending on the command

In order to make switching roles possible via interactive prompts, the refresh flag should default to true, but be able to be disabled bmx print --no-refresh would stop at 3. and just act like it currently does (selection for account, role, etc.)

@dougmoscrop dougmoscrop changed the title Bring back 'renew' command Support refresh (by default, with opt-out) for print and write Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants