Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Commit

Permalink
support AWS_DEFAULT_REGION and AWS_DEFAULT_PROFILE
Browse files Browse the repository at this point in the history
	modified:   botoform/__main__.py
  • Loading branch information
russellballestrini committed Aug 10, 2017
1 parent 26b2f74 commit 87bd245
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions botoform/__main__.py
Expand Up @@ -4,6 +4,8 @@

from botoform.enriched import EnrichedVPC

from os import environ

def get_profile_names():
"""Return a list of profile names in ~/.aws/config"""
import botocore.session
Expand Down Expand Up @@ -39,10 +41,11 @@ def build_parser(description, load_subparser_plugins=False):
"""build argparser and attach each plugin's parser to subparser."""
parser = argparse.ArgumentParser(description = description)
#requiredNamed = parser.add_argument_group('required named arguments')
parser.add_argument('-p', '--profile', default='default',
choices=get_profile_names(),
parser.add_argument('-p', '--profile', choices=get_profile_names(),
default=environ.get('AWS_DEFAULT_PROFILE', None),
help='botocore profile name for AWS creds and other vars.')
parser.add_argument('-r', '--region', default=None,
parser.add_argument('-r', '--region',
default=environ.get('AWS_DEFAULT_REGION', None),
help='AWS region to use')
#parser.add_argument('--search-regions', action='store_true', default=False,
# help='search regions for VPC with given vpc_name')
Expand Down

0 comments on commit 87bd245

Please sign in to comment.