Skip to content

Generate will include invalid characters in profile names #825

@timwisbauer

Description

@timwisbauer

Problem

We're in the unfortunate position to have [] in our AWS account names like this: Company Name [production].

granted sso generate happily generates a config with these account names, but using them results in an error. Is it possible to automatically strip these characters out?

Example generated config:

[profile Company-Name-[production]/RoleName]
granted_sso_start_url      = https://<REDACTED>.awsapps.com/start
granted_sso_region         = <REDACTED>
granted_sso_account_id     = <REDACTED>
granted_sso_role_name      = <REDACTED>
common_fate_generated_from = aws-sso
credential_process         = granted credential-process --profile Company-Name-[production]/RoleName

The profile doesn't appear in the list when I run assume, but when I attempt to use the profile via environment variable I get:

❯ export AWS_PROFILE='Company-Name-[production]/RoleName'
❯ aws sts get-caller-identity

Error when retrieving credentials from custom-process: [!] The profile Company-Name-[production]/RoleName cannot be loaded because the name contains one or more of these characters '\][;'"'
[i] Try renaming the profile to 'Company-Name-[production]/RoleName'
[✘] profile not found

Alternative Solutions Considered

For now I've just been renaming the generated profiles manually. I've also re-generated using the template parameter and account ID instead. Both of these work fine TBH, but it'd be nice to have the generate command automatically remove the invalid characters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions