ec2.py: iam_role option fails when using more than one region #40336
Labels
affects_2.4
This issue/PR affects Ansible v2.4
aws
bug
This issue/PR relates to a bug.
c:inventory/contrib_script
cloud
inventory
Inventory category
support:community
This issue/PR relates to code supported by the Ansible community.
ISSUE TYPE
COMPONENT NAME
contrib/inventory/ec2.py
ANSIBLE VERSION
CONFIGURATION
ec2.ini:
OS / ENVIRONMENT
AWS
SUMMARY
On these lines:
ansible/contrib/inventory/ec2.py
Lines 574 to 593 in e0893aa
connect_args
is a reference toself.credentials
instead of a copy.This causes that, when
iam_role
is set and more than a region is specified, it will:iam_role
, and overwriteself.credentials
with the credentials for the assumed IAM roleSTEPS TO REPRODUCE
Setup ec2.ini as set before, with an IAM role that has to be assumed and multiple regions
EXPECTED RESULTS
Working inventory
ACTUAL RESULTS
PROPOSED FIX
A brief locally test shows that this workaround works - I think there shouldn't be any other side effects in the code but couldn't test further.
The text was updated successfully, but these errors were encountered: