-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix passing an instance profile arn to ec2_launch_template #371
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi @kepstin, Thanks for the time you've taken to submit this PR. Do you think you'd be able to update our integration tests to include the failure mode you were seeing? We already have some tests which try to exercise the iam_instance_profile option. I'm guessing they didn't go far enough: |
I don't really know enough about how the integration test setup works to be able to do that. It looks like the current tests provide only a role name, and use the arn lookup functionality - to test the issue that i've been seeing, a test has to be added that instead provides an instance profile arn that matches the regex shown in
I assume this would require some setup in the test aws environment to ensure that an instance profile is available with a known fixed arn (or to determine the arn out of band and provide it). |
If the string given on the iam_instance_profile looked like an arn, the wrong structure format was being returned. boto3 expects a dict of the format { arn: "{{ arn }}" } but the string was returned instead. This fixes this error: Couldn't create subsequent launch template version: Parameter validation failed: Invalid type for parameter LaunchTemplateData.IamInstanceProfile, value: arn:aws:iam::[...]:instance-profile/[...], type: <class 'str'>, valid types: <class 'dict'>
@kepstin sorry it's taken a while. I've added a changelog fragment and simple test. I think we're ready to get this PR merged. |
…ollections#371) * Fix passing an instance profile arn to ec2_launch_template If the string given on the iam_instance_profile looked like an arn, the wrong structure format was being returned. boto3 expects a dict of the format { arn: "{{ arn }}" } but the string was returned instead. This fixes this error: Couldn't create subsequent launch template version: Parameter validation failed: Invalid type for parameter LaunchTemplateData.IamInstanceProfile, value: arn:aws:iam::[...]:instance-profile/[...], type: <class 'str'>, valid types: <class 'dict'> * integration test * changelog Co-authored-by: Mark Chappell <[email protected]>
…ollections#371) * Fix passing an instance profile arn to ec2_launch_template If the string given on the iam_instance_profile looked like an arn, the wrong structure format was being returned. boto3 expects a dict of the format { arn: "{{ arn }}" } but the string was returned instead. This fixes this error: Couldn't create subsequent launch template version: Parameter validation failed: Invalid type for parameter LaunchTemplateData.IamInstanceProfile, value: arn:aws:iam::[...]:instance-profile/[...], type: <class 'str'>, valid types: <class 'dict'> * integration test * changelog Co-authored-by: Mark Chappell <[email protected]>
…ollections#371) * Fix passing an instance profile arn to ec2_launch_template If the string given on the iam_instance_profile looked like an arn, the wrong structure format was being returned. boto3 expects a dict of the format { arn: "{{ arn }}" } but the string was returned instead. This fixes this error: Couldn't create subsequent launch template version: Parameter validation failed: Invalid type for parameter LaunchTemplateData.IamInstanceProfile, value: arn:aws:iam::[...]:instance-profile/[...], type: <class 'str'>, valid types: <class 'dict'> * integration test * changelog Co-authored-by: Mark Chappell <[email protected]>
ansible-collections#371) ec2_vol: Fix iops setting and enforce iops/throughput parameters usage Reviewed-by: https://github.com/apps/ansible-zuul
SUMMARY
If the string given on the iam_instance_profile looked like an arn, the
wrong structure format was being returned. boto3 expects a dict of the
format { arn: "{{ arn }}" } but the bare arn string was returned instead.
This fixes this error:
ISSUE TYPE
COMPONENT NAME
community.aws.ec2_launch_template