1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add support for AWS_SESSION_TOKEN environment variable.

According to http://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs
the "official" environment variables that should be used for
AWS credentials should be:
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN
This patch adds support for the latter (the first two are already
supported).
This commit is contained in:
Michael Ludvig 2016-02-08 00:09:44 +13:00
parent 50dfd4b057
commit ab64918cb5

View file

@ -153,6 +153,8 @@ def get_aws_connection_info(module, boto3=False):
if not security_token:
if 'AWS_SECURITY_TOKEN' in os.environ:
security_token = os.environ['AWS_SECURITY_TOKEN']
elif 'AWS_SESSION_TOKEN' in os.environ:
security_token = os.environ['AWS_SESSION_TOKEN']
elif 'EC2_SECURITY_TOKEN' in os.environ:
security_token = os.environ['EC2_SECURITY_TOKEN']
else: