Skip to content
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

In version 8.2.0 amazon.aws.iam_role create_instance_profile: false no longer works #2281

Closed
1 task done
chrisahl opened this issue Sep 4, 2024 · 0 comments · Fixed by #2282
Closed
1 task done

Comments

@chrisahl
Copy link

chrisahl commented Sep 4, 2024

Summary

When I try using the newly released 8.2.0, amazon.aws.iam_role create_instance_profile: false is not working. It always tries to create the profile, which fails in my case and is why I am telling iam_role not to create the profile. This was working in 8.1.0.

I believe the changes made in braydencw1@750eef7 have a few bugs.

I don't think this change in iam_role.py
image
is correct. Did you mean to use and instead of or?

Also think you need to change these lines in iam_role.py to is not None
image

Issue Type

Bug Report

Component Name

iam_role

Ansible Version

$ ansible --version

ansible-playbook [core 2.17.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/github/home/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.11/site-packages/ansible
  ansible collection location = /github/home/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.11.7 (main, Jul  4 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3.11)
  jinja version = 3.1.4
  libyaml = True

Collection Versions

$ ansible-galaxy collection list

Collection              Version     
----------------------- ------------
amazon.aws              8.2.0       
community.aws           8.0.0     

AWS SDK versions

$ pip show boto boto3 botocore

Name: boto3
Version: 1.35.11
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /usr/local/lib/python3.9/site-packages
Requires: botocore, jmespath, s3transfer
Required-by: 
---
Name: botocore
Version: 1.35.11
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /usr/local/lib/python3.9/site-packages
Requires: jmespath, python-dateutil, urllib3
Required-by: boto3, s3transfer
---

Configuration

$ ansible-config dump --only-changed

OS / Environment

RHEL 9

Steps to Reproduce

    - name: Create 'My-Reader-Role'
      amazon.aws.iam_role:
        name: My-Reader-Role
        profile: ""
        assume_role_policy_document: "{{ policy_file | to_nice_json }}"
        create_instance_profile: false
        description: The my AWS reader role.
        max_session_duration: 7200

Expected Results

The create instance profile SHOULD NOT be tried, but it always is, no matter the setting.

Actual Results

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
tremble added a commit to tremble/amazon.aws that referenced this issue Sep 4, 2024
tremble added a commit to tremble/amazon.aws that referenced this issue Sep 4, 2024
tremble added a commit to tremble/amazon.aws that referenced this issue Sep 4, 2024
softwarefactory-project-zuul bot pushed a commit that referenced this issue Sep 4, 2024
…en not creating a profile (#2282)

fixes: #2102
fixes: #2281
SUMMARY

#2221 deprecation logic accidentally forced create_instance_profile to True
The IAM refactor made iam_role sensitive to pre-existing instance profiles with the same name.

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
iam_role
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
Reviewed-by: GomathiselviS
patchback bot pushed a commit that referenced this issue Sep 4, 2024
…en not creating a profile (#2282)

fixes: #2102
fixes: #2281
SUMMARY

#2221 deprecation logic accidentally forced create_instance_profile to True
The IAM refactor made iam_role sensitive to pre-existing instance profiles with the same name.

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
iam_role
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
Reviewed-by: GomathiselviS
(cherry picked from commit 4867e68)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Sep 4, 2024
…en not creating a profile (#2282) (#2283)

This is a backport of PR #2282 as merged into main (4867e68).
fixes: #2102
fixes: #2281
SUMMARY

#2221 deprecation logic accidentally forced create_instance_profile to True
The IAM refactor made iam_role sensitive to pre-existing instance profiles with the same name.

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
iam_role
ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant