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

Make Profile flag optional and change default behaviour #30

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

danifitz
Copy link

@danifitz danifitz commented Nov 8, 2021

Make the -p flag optional allowing user to supply one or more profiles to be used to gather inventory.

New default behaviour, if -p is omitted, we'll just use the default AWS CLI behaviour which is to look for env vars such as AWS_SECRET_ACCESS_KEY.

Examples:

./lw_aws_inventory.sh - gather inventory for the account defined on the machines env vars
./lw_aws_inventory.sh -j - same as above but with JSON output.
./lw_aws_inventory.sh -p prod - gather inventory for the account with profile prod in ~/.aws/credentials
aws-vault exec profile_name -- ./lw_aws_inventory.sh - gather inventory using credentials from aws vault

…lag optional rather than mandatory. User can pass a single profile or comma seperated list of AWS profiles using -p flag. If -p isnt specified, it will attempt to use any environment which is configured.
case ${opt} in
p )
USE_PROFILE="true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding a description of the script options to the PR.
Could we add something to the echo to describe the fields?

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

Successfully merging this pull request may close these issues.

2 participants