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

manage a aws-sso profile in ~/.aws/config #157

Closed
synfinatic opened this issue Nov 22, 2021 · 3 comments
Closed

manage a aws-sso profile in ~/.aws/config #157

synfinatic opened this issue Nov 22, 2021 · 3 comments
Labels
enhancement New feature or request priority:high High Priority Items
Milestone

Comments

@synfinatic
Copy link
Owner

synfinatic commented Nov 22, 2021

The idea here is that rather than setting a bunch of variables in the environment, it may just be easier to manage named profiles in the aws config files. per the docs we can even pass in the AWS_SESSION_TOKEN in the config file and of course the region as well. Seems very similar to #15.

You could then even run aws-sso as a daemon and it can auto-refresh credentials before they expire.

AWS even has support for doing this via external processes: https://docs.aws.amazon.com/cli/latest/topic/config-vars.html#sourcing-credentials-from-external-processes (Fixed in #158)

Depends on #212

@synfinatic synfinatic added the enhancement New feature or request label Nov 22, 2021
synfinatic added a commit that referenced this issue Nov 23, 2021
 * Local cache was not saving during auto-refresh causing
    future runs to not use the cache and slowing execution after 24hrs.
 * Add support for AWS `credential_process` output in ~/.aws/config
   files

Refs #157
synfinatic added a commit that referenced this issue Nov 23, 2021
 * Local cache was not saving during auto-refresh causing
    future runs to not use the cache and slowing execution after 24hrs.
 * Add support for AWS `credential_process` output in ~/.aws/config
   files

Refs #157
synfinatic added a commit that referenced this issue Nov 23, 2021
 * Local cache was not saving during auto-refresh causing
    future runs to not use the cache and slowing execution after 24hrs.
 * Add support for AWS `credential_process` output in ~/.aws/config
   files

Refs #157
@synfinatic
Copy link
Owner Author

So the question is basically, should the user have:

  1. One profile for all AWS SSO Roles (means you can't have different roles in different terminal sessions)
  2. Multiple profiles and some how map a role to a profile
  3. 1:1 mapping of profiles and roles

Only the 3rd option seems useful? Basically turns into a question can we edit the ~/.aws/config file and add/delete profiles when the role becomes (un)available?

As of AWS CLI v2, it honors AWS_CONFIG_FILE=/path/to/config_file so that's an option too?

@synfinatic
Copy link
Owner Author

synfinatic commented Dec 26, 2021

what about just using a template marker like terraform-docs does? aka:

<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->

and generate a series of entries like:

[profile <name>]
credential_process = /usr/local/bin/aws-sso process --sso <name> --arn <arn>

then users can just use the typical AWS_PROFILE environment variable for AWS SSO just like more traditional static API keys. This becomes a really consistent user experience.

@synfinatic synfinatic modified the milestones: 1.6.1, 1.7 Dec 26, 2021
@synfinatic synfinatic added the priority:high High Priority Items label Jan 2, 2022
@synfinatic
Copy link
Owner Author

also should support output=json or other output values

synfinatic added a commit that referenced this issue Jan 3, 2022
* Roles now support specifying a custom `Profile` value
    which is used as `AWS_SSO_PROFILE` and for the profile name
    in ~/.aws/config
* Add support for the `config` command which generates the necessary
    profile entries in ~/.aws/config
* Add StringReplace function for ProfileFormat

Refs: #157, #212
synfinatic added a commit that referenced this issue Jan 3, 2022
* Roles now support specifying a custom `Profile` value
    which is used as `AWS_SSO_PROFILE` and for the profile name
    in ~/.aws/config
* Add support for the `config` command which generates the necessary
    profile entries in ~/.aws/config
* Add StringReplace function for ProfileFormat

Refs: #157, #212
synfinatic added a commit that referenced this issue Jan 3, 2022
* Roles now support specifying a custom `Profile` value
    which is used as `AWS_SSO_PROFILE` and for the profile name
    in ~/.aws/config
* Add support for the `config` command which generates the necessary
    profile entries in ~/.aws/config
* Add StringReplace function for ProfileFormat

Refs: #157, #212
synfinatic added a commit that referenced this issue Jan 3, 2022
* Roles now support specifying a custom `Profile` value
    which is used as `AWS_SSO_PROFILE` and for the profile name
    in ~/.aws/config
* Add support for the `config` command which generates the necessary
    profile entries in ~/.aws/config
* Add StringReplace function for ProfileFormat

Refs: #157, #212
synfinatic added a commit that referenced this issue Jan 3, 2022
* Roles now support specifying a custom `Profile` value
    which is used as `AWS_SSO_PROFILE` and for the profile name
    in ~/.aws/config
* Add support for the `config` command which generates the necessary
    profile entries in ~/.aws/config
* Add StringReplace function for ProfileFormat
* Refactor *AWSRoleFlat & *Roles into cache_roles.go
* Add a bunch of unit tests

Refs: #157, #212
synfinatic added a commit that referenced this issue Jan 3, 2022
* Roles now support specifying a custom `Profile` value
    which is used as `AWS_SSO_PROFILE` and for the profile name
    in ~/.aws/config
* Add support for the `config` command which generates the necessary
    profile entries in ~/.aws/config
* Add StringReplace function for ProfileFormat
* Refactor *AWSRoleFlat & *Roles into cache_roles.go
* Add a bunch of unit tests

Refs: #157, #212
synfinatic added a commit that referenced this issue Jan 4, 2022
synfinatic added a commit that referenced this issue Jan 4, 2022
synfinatic added a commit that referenced this issue Jan 5, 2022
 * Fix diffing across multiple runs
 * Consistent ordering based on SSO instance & ARN
 * Now updates the config file

Refs: #157
synfinatic added a commit that referenced this issue Jan 5, 2022
 * Fix diffing across multiple runs
 * Consistent ordering based on SSO instance & ARN
 * Now updates the config file

Refs: #157
synfinatic added a commit that referenced this issue Jan 5, 2022
 * Fix diffing across multiple runs
 * Consistent ordering based on SSO instance & ARN
 * Now updates the config file

Refs: #157
synfinatic added a commit that referenced this issue Jan 5, 2022
 * `eval` now supports `--url-action=print` because we now print to
   STDERR
 * Clarify that `process` does _NOT_ support print, because the AWS
    tooling eats STDERR.
 * `config` now takes an `--open` flag for overriding `UrlAction`
    in the config file with the `--url-action` flag on the CLI.

Refs: #157
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority:high High Priority Items
Projects
None yet
Development

No branches or pull requests

1 participant