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

Cannot override default values using profile parameter #85

Open
mariceslia opened this issue Mar 24, 2023 · 0 comments
Open

Cannot override default values using profile parameter #85

mariceslia opened this issue Mar 24, 2023 · 0 comments

Comments

@mariceslia
Copy link

Is there any reason why the value of the profile parameter is not allowed to be overridden ?

{
  "app_id": "123456",
  "subdomain": "myolsubdomain",
  "username": "user.name",
  "profile": "profile-1",
  "duration": 3600,
  "aws_region": "us-west-2",
  "aws_account_id": "aaa",
  "aws_role_name": "",
  "profiles": {
    "profile-1": {
      "aws_account_id": "",
      "aws_role_name": "",
      "aws_region": "",
      "app_id": ""
    },
    "profile-2": {
      "aws_account_id": "bbb"
    }
  }
}

profiles Contains a list of profile->account id, and optionally role name mappings. If this attribute is populated aws_account_id, aws_role_name, aws_region, and app_id will be set based on the profile provided when running the script.

I understand that if we set up profiles and specify the target with the profile parameter at runtime, we can override the default values.

  • default aws_account_id: aaa
  • --profile profile-2 aws_account_id: bbb

if 'aws_account_id' in profile.keys() and profile['aws_account_id'] and not options.aws_account_id:
options.aws_account_id = profile['aws_account_id']
if 'aws_role_name' in profile.keys() and profile['aws_role_name'] and not options.aws_role_name:
options.aws_role_name = profile['aws_role_name']
if 'aws_region' in profile.keys() and profile['aws_region'] and not options.aws_region:
options.aws_region = profile['aws_region']
if 'app_id' in profile.keys() and profile['app_id'] and not options.app_id:
options.app_id = profile['app_id']

However, under the conditions of the code, it is not possible to override a value for which a default value has already been set.
(and not options.aws_account_id)
Is there any reason why the value of the profile parameter is not allowed to be overridden ?

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