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

Remove default aws region #318

Merged
merged 2 commits into from
Feb 7, 2017

Conversation

troyready
Copy link
Contributor

This will still allow the region to be specified via '-r', but adds the
additional option to set it via AWS_DEFAULT_ENVIRONMENT.

A failure to provide either will generate a fairly clear stacktrace
like:

...
  File "/Users/troyready/Library/Python/2.7/lib/python/site-packages/botocore/regions.py", line 135, in _endpoint_for_partition
    raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.

This does introduce an additional unit testing requirement to set the environment variable; not sure if there's a better way to handle that for the kms lookup?

It's a fairly major change, but this follows alongside the logic of #298 and will help keep mistakes from happening (a NoRegionError is more clear than an xref failing with a output lookup stacktrace, or a bunch of stuff deployed to the wrong region).

This will still allow the region to be specified via '-r', but adds the
additional option to set it via `AWS_DEFAULT_ENVIRONMENT`.

A failure to provide either will generate a fairly clear stacktrace
like:
```
...
  File "/Users/troyready/Library/Python/2.7/lib/python/site-packages/botocore/regions.py", line 135, in _endpoint_for_partition
    raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.
```
@troyready
Copy link
Contributor Author

As an aside: I ended up writing this after taking a more serious look at fixing #277 and finding the required changed to be so daunting that it seemed better to just keep putting it off.

@ttaub
Copy link
Contributor

ttaub commented Feb 7, 2017

Looks good to me, I like that it doesn't just automatically assume the default region. @troyready would you be able to write some tests for it?

@troyready
Copy link
Contributor Author

@ttaub sure thing, PR updated.

The only change to the connection code is logic around None being returned from the config, so I added a test for that config parsing.

@phobologic
Copy link
Member

Honestly, I think we should just do away with --region altogether, and use the standard (ie: either profile, the environment variable, or stack specific - when we have stack specific). What do you think @troyready ?

@phobologic phobologic merged commit e9e665d into cloudtools:release-1.0 Feb 7, 2017
phrohdoh pushed a commit to phrohdoh/stacker that referenced this pull request Dec 18, 2018
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.

3 participants