Use get_aws_connection_info to get AWS creds.
Previously used get_ec2_creds did not consider security_token, making MFA requests fail.
This commit is contained in:
parent
831e1d8739
commit
8bff781a0a
1 changed files with 2 additions and 6 deletions
|
@ -1207,15 +1207,11 @@ def main():
|
|||
|
||||
ec2 = ec2_connect(module)
|
||||
|
||||
ec2_url, aws_access_key, aws_secret_key, region = get_ec2_creds(module)
|
||||
region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module)
|
||||
|
||||
if region:
|
||||
try:
|
||||
vpc = boto.vpc.connect_to_region(
|
||||
region,
|
||||
aws_access_key_id=aws_access_key,
|
||||
aws_secret_access_key=aws_secret_key
|
||||
)
|
||||
vpc = boto.vpc.connect_to_region(region, **aws_connect_kwargs)
|
||||
except boto.exception.NoAuthHandlerFound, e:
|
||||
module.fail_json(msg = str(e))
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue