common-fate / granted

The easiest way to access your cloud.
https://granted.dev
MIT License
1k stars 93 forks source link

AWS_DEFAULT_REGION environment variable is not set, breaks boto3 #457

Closed icj217 closed 11 months ago

icj217 commented 1 year ago

I've noticed that the AWS_DEFAULT_REGION env var is not set by the assume command. Is this intentional? There are scenarios where AWS_REGION is not used/parsed by some AWS tools, namely boto3.

For example:

$ assume <profile>
$ python
>>> import boto3
>>> boto3.client('ssm').list_parameters()
Traceback (most recent call last):
  ...
  File "/<REDACTED>/.pyenv/versions/3.8.2/lib/python3.8/site-packages/botocore/regions.py", line 215, in _endpoint_for_partition
    raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.

Would it be possible to have the tool set this environment variable as well? I'm happy to take a crack at it, assuming there aren't any underlying problems with doing so.