Add a flag to allow us to override the aws credentials profile that the credentials are saved under. - #500
Merged
Conversation
…ial profile the creds will be saved under
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Currently we allow the AWS profile name the credentials will be saved under via the configuration file (either per profile or via inheritance) or via a environment variable. This PR adds a feature flag that will allow users to specify
--aws-cred-profile <profile name>. This flag would take precedence and override both the environment variable if set and the profile from the configuration file. This allows tooling to standardize profile names even if a user has a profile specified that they prefer for use outside of that tooling.Related Issue
#499
Motivation and Context
The
cred_profilesetting can currently be set via the config file or theGIMME_AWS_CREDS_CRED_PROFILEenvironment variable, but there is no CLI flag to override it per-invocation. This is inconsistent with other settings likeoutput_format, which supports all three layers: config file, environment variable (GIMME_AWS_CREDS_OUTPUT_FORMAT), and CLI flag (--output-format).A CLI flag is useful when switching credential profile strategies on the fly — for example, writing to a specific named profile for a one-off script or CI job without modifying the config file or polluting the shell environment.
How Has This Been Tested?
tests/test_config.py): Verifies that--aws-cred-profileis correctly parsed and stored on theConfigobject, and that it defaults toNonewhen not provided.tests/test_main.py::TestCredProfilePrecedence): Exercises the fullgenerate_config()flow with a real config file, environment variables, and CLI arguments to verify the override chain:aws_cred_profileargument in mockedNamespaceobjects so they continue to pass.Screenshots (if appropriate):
Types of changes
Checklist: