From 86e679fe3cbc2fe4524cc9b8604962f8c3f65f52 Mon Sep 17 00:00:00 2001 From: billwanjohi Date: Tue, 23 Jun 2015 18:31:48 +0000 Subject: [PATCH] iam: use modern helper to allow sts previous implementation ignored the session token when present --- lib/ansible/modules/cloud/amazon/iam.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/iam.py b/lib/ansible/modules/cloud/amazon/iam.py index 5dd45d83444..d844bbc7b1c 100644 --- a/lib/ansible/modules/cloud/amazon/iam.py +++ b/lib/ansible/modules/cloud/amazon/iam.py @@ -576,13 +576,10 @@ def main(): module.fail_json(changed=False, msg="iam_type: role, cannot currently be updated, " "please specificy present or absent") - ec2_url, aws_access_key, aws_secret_key, region = get_ec2_creds(module) + region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module) try: - iam = boto.iam.connection.IAMConnection( - aws_access_key_id=aws_access_key, - aws_secret_access_key=aws_secret_key, - ) + iam = boto.iam.connection.IAMConnection(**aws_connect_kwargs) except boto.exception.NoAuthHandlerFound, e: module.fail_json(msg=str(e))