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

Accept Profile property "source_profile" in config by disregarding the property #337

Open
LazaroOnline opened this issue Nov 30, 2023 · 0 comments

Comments

@LazaroOnline
Copy link

LazaroOnline commented Nov 30, 2023

The problem:
We want to use the same profile config for both our AWS-CLI and this AWS-Switch-Roles plugin so it is easier to manage and we just edit it once and then copy and paste from/to the local /.aws/credentials file and this plugin's config.

In our AWS-CLI credentials we need the property "source_profile" in each profile so it picks up the Multi-Factor-Authentication token from another profile, since we have a single shared profile to store the MFA token.
The problem is AWS-switch-roles plugin breaks if the property "source_profile" is added showing the message:
The following profiles are referenced as 'source_profile' but not defined: MfaProfileNameHere
if i try to add a profile with that name to make the error go away then it requires the profile to have an account id and role name which I don't want to add because on its own the MfaProfileNameHere should not be a visible role option in the plugin menu.
If I still add the required properties then it saves the config successfully but then something goes wrong and it just won't show the role that has the "source_profile" property in the plugin's menu.

Solution:

Just disregard the property "source_profile". I don't know if there is any use-case where this property is used, but most probably there isn't, given that this plugin only requires account-id and role-name to work.

TLDR:

Just make this config work:

[dev]
color=ff0000
region=eu-west-1
source_profile = SomeProfileDontMindMeOk
role_arn = arn:aws:iam::012345678901:role/SomeRoleName

[prod]
color=0000ff
region=eu-west-1
source_profile = SomeProfileDontMindMeOk
role_arn = arn:aws:iam::123456789012:role/SomeRoleName

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

1 participant