summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Ludvig <mludvig@logix.net.nz>2016-02-08 00:09:44 +1300
committerMichael Ludvig <mludvig@logix.net.nz>2016-02-08 00:25:13 +1300
commitab64918cb52d2469b663eaac9335ab096aa9621d (patch)
treed80cf2aa664ad1ab08e01073cabb54ebf54a9273
parent50dfd4b057478051062dc3999f616265d1d9ad54 (diff)
downloadansible-ab64918cb52d2469b663eaac9335ab096aa9621d.tar.gz
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).
-rw-r--r--lib/ansible/module_utils/ec2.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/ansible/module_utils/ec2.py b/lib/ansible/module_utils/ec2.py
index 7b93d9bb7e..a360c2e672 100644
--- a/lib/ansible/module_utils/ec2.py
+++ b/lib/ansible/module_utils/ec2.py
@@ -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: