aws-sso-cli icon indicating copy to clipboard operation
aws-sso-cli copied to clipboard

Support tags in ListFields

Open Moulick opened this issue 2 years ago • 7 comments

Is your feature request related to a problem? Please describe

Having the tags in aws-sso list would be helpful 😄

Describe the solution you'd like

Support Account/Role tags in ListFields

AccountName          | AccountAlias | AccountIdPad | Expires | Profile               | RoleName    |  Tags                     
===============================================================================================================================
company-a-production | c-12334-prod | 123456789123 | 59m     | 123456789123:ReadOnly | c-Developer | team:team-a,type:internal

Moulick avatar Aug 15 '23 23:08 Moulick

Yeah I've been thinking about this myself. The thing that I don't have a good handle on is that roles can have lots of tags and I don't want the list command to only be useful on 5K wide screen monitors. How to keep this manageable? Any thoughts?

synfinatic avatar Aug 16 '23 00:08 synfinatic

Maybe, make this column optional. The user can decide whether this info is helpful/ useful depending on the amount of tag that are used. Another option is to filter tags, eg. you could specify the tag keys to be included in the config.yml. This way the user can sort out any technical/ standart tags WDYT?

PacoVK avatar Aug 16 '23 05:08 PacoVK

We could probably support sprig as in ProfileFormat where then the user could define {{ .Tags.xyz }}, or only show the tags mentioned in AccountPrimaryTag ?

Moulick avatar Aug 16 '23 11:08 Moulick

So is the general consensus that <name>:<value> the correct output format?

@Moulick: What would {{ .Tags.xyz }} output?

synfinatic avatar Aug 21 '23 00:08 synfinatic

I take back {{ .Tags.xyz}}, that was a bad suggestion. I am now thinking something like (minimal config)

SSOConfig:
  Default:
    Accounts:
      123456789123:
        Name: company-a-production
        Tags:
          team: team-a
          type: internal  

ProfileFormat: "{{ coalesce .AccountName .AccountIdPad }}:{{ .RoleName }}"

AccountPrimaryTag:
  - env

ListFields:
  - AccountName
  - Tags
    - team
    - type
  - AccountAlias
  - AccountIdPad
  # - Arn
  - Expires
  - Profile
  - RoleName

will produce

❯ aws-sso list
List of AWS roles for SSO Instance: Default [Expires in: 7h 22m]

AccountName          |  Tags                      | AccountAlias | AccountIdPad | Expires | Profile               | RoleName    
================================================================================================================================
company-a-production | team:team-a, type:internal | c-12334-prod | 123456789123 | 59m     | 123456789123:ReadOnly | c-Developer 

Moulick avatar Aug 21 '23 08:08 Moulick

If you wish, I can hack together an initial draft for the PR?

Moulick avatar Aug 21 '23 08:08 Moulick

I really like that idea @Moulick. Would love to see you give it a go!

synfinatic avatar Aug 21 '23 15:08 synfinatic