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

Migrate iam_role* modules and tests #1760

Merged

Conversation

abikouo
Copy link
Contributor

@abikouo abikouo commented Sep 20, 2023

SUMMARY

Migrate modules iam_role and iam_role_info from community.aws

ISSUE TYPE

New Module Pull Request

COMPONENT NAME

iam_role
iam_role_info

jillr and others added 30 commits September 20, 2023 18:26
* Rename core collection

Rename references to ansible.amazon to amazon.aws.

* Rename community.amazon to community.aws
Fix pep8 line lengths for rewritten amazon.aws imports

* Missed a path in shippable.sh
* Dependency repos moved

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@235c5db
* Remove ANSIBLE_METADATA entirely, see ansible/ansible/pull/69454.
Remove `license` field from galaxy.yml, in favor of `license_file`.

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@05672a6
* Update module deprecations

Switch version to `removed_at_date`

* Don't install amazon.aws from galaxy

We've been using galaxy to install amazon.aws in shippable, but that
doesn't really work if we aren't publising faster. Get that collection
from git so it is most up to date.

* We need to declare python test deps now

* missed a python dep

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@7cd211e
* Update docs

Remove .git from repo url so links in readme will generate correctly
Add required ansible version
Run latest version of add_docs.py
Add version_added string to modules

* galaxy.yml was missing authors

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@96ee268
* Reorder imports
* Make use of is_boto3_error_message
* Mass-migration over to is_boto3_error_code
* Remove unused imports
* unused vars in exception
* Improve consistency around catching BotoCoreError and ClientError
* Remove unused imports
* Remove unused 'PolicyError' from iam_policy_info
* Avoid catching botocore.exceptions.ClientError when we only want some error codes
* Import camel_dict_to_snake_dict/snake_dict_to_camel_dict from ansible.module_utils.common.dict_transformations

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@4cf52ef
ansible-collections#411)

Add some additional comments so we know *why* the various tests aren't running.  Looks like most of them just need policy updates

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@0d24559
Add waiter to the iam_role module

SUMMARY
This change adds the wait param used in other AWS modules, adding usage of a waiter for the iam_role creation / updates.
Currently there is no waiting done to ensure the iam_role has actually created and is available before exiting.
The tests have also been split up into separate files to make it a bit more manageable.
Fixes: ansible-collections#710
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
iam_role
ADDITIONAL INFORMATION
Successful run completed of the iam_role integration test suite locally:
ansible-test integration --docker centos8 -v iam_role --allow-unsupported
PLAY RECAP *********************************************************************
testhost                   : ok=198  changed=46   unreachable=0    failed=0    skipped=0    rescued=0    ignored=7

AWS ACTIONS: ['iam:AddRoleToInstanceProfile', 'iam:AttachRolePolicy', 'iam:CreateInstanceProfile', 'iam:CreatePolicy', 'iam:CreateRole', 'iam:DeleteInstanceProfile', 'iam:DeletePolicy', 'iam:DeleteRole', 'iam:DeleteRolePermissionsBoundary', 'iam:DeleteRolePolicy', 'iam:DetachRolePolicy', 'iam:GetRole', 'iam:GetRolePolicy', 'iam:ListAttachedRolePolicies', 'iam:ListEntitiesForPolicy', 'iam:ListInstanceProfilesForRole', 'iam:ListPolicies', 'iam:ListPolicyVersions', 'iam:ListRolePolicies', 'iam:ListRoleTags', 'iam:ListRoles', 'iam:PutRolePermissionsBoundary', 'iam:PutRolePolicy', 'iam:RemoveRoleFromInstanceProfile', 'iam:TagRole', 'iam:UntagRole', 'iam:UpdateRole']
Run command: docker exec 56cb328c6d9af293d9e820e1f2a94fb8ca87e0769b2b9b6d46bad661f9edde65 tar czf /root/output.tgz --exclude .tmp -C /root/ansible/ansible_collections/community/aws/tests output
Run command: docker exec -i 56cb328c6d9af293d9e820e1f2a94fb8ca87e0769b2b9b6d46bad661f9edde65 dd if=/root/output.tgz bs=65536
Run command: tar oxzf /tmp/ansible-result-k2lnga3v.tgz -C /mnt/c/Users/mark.woolley/Documents/GitHub/public/ansible_collections/community/aws/tests
Run command: docker rm -f 56cb328c6d9af293d9e820e1f2a94fb8ca87e0769b2b9b6d46bad661f9edde65

Reviewed-by: Mark Chappell <None>
Reviewed-by: None <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@81d9abd
Remove deprecated "facts" aliases

SUMMARY
Modules named "facts.py" that do not return ansible_facts were renamed to "info.py" in 2.9. Remove these aliases now that the deprecation period is over.
This PR should be included in 3.0.0 of the collection.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
*_facts.py

Reviewed-by: Mark Chappell <None>
Reviewed-by: Jill R <None>
Reviewed-by: None <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@68aaa70
…ible-collections#961)

IAM Role Removal Does Not Require Removal of Permission Boundary

SUMMARY

Removes unnecessary removal of permission boundary from a role when deleting a role. Unlike inline policies, permission boundaries do not need to be removed from an IAM role before deleting the IAM role. This behavior causes issues when a permission boundary is inherited that prevents removal of the permission boundary.
Fixes ansible-collections#959

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
iam_role

Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Mark Chappell <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@e670b34
…aws (ansible-collections#1054)

iam_role - delete inline policies, stabilize for migration to amazon.aws

SUMMARY
Stabilize for migration to amazon.aws

delete inline policies before deleting the role
removed global vars and refactored function definitions
added some extra integration tests for check mode

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
iam_role

Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Joseph Torcasso <None>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: Jill R <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@ce41867
…1068)

Revert breaking change - iam_role return values

SUMMARY
This hasn't been release yet, so a changelog isn't needed.
While I'm generally good with cleaning up the output values here, this needs to be done as a separate breaking change, and must not be backported to stable-3.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
iam_role
ADDITIONAL INFORMATION
Breaking change silently introduced by ansible-collections#1054

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Joseph Torcasso <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@8d80e9a
Integration test dependency cleanup

SUMMARY

remove dependencies on setup_remote_tmp_dir where it's not used (often just copy & paste from another test)
remove setup_ec2 (no main.yml means it's not doing anything)
remove prepare_tests (empty main.yml means it's not doing anything)

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
tests/integration/targets
ADDITIONAL INFORMATION
By cleaning up what we have we reduce the chance of people copying things about "because that's what test XYZ did".

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Mark Woolley <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@dd12046
…sible-collections#1182)

Tagging fragment - Move simplest cases over to the docs fragment.

Depends-On: ansible-collections#844
SUMMARY
Migrate simplest cases over to the new docs fragment and add resource_tags as an alias to tags.
ISSUE TYPE

Docs Pull Request
Feature Pull Request

COMPONENT NAME
changelogs/fragments/1182-tagging.yml
plugins/modules/aws_glue_job.py
plugins/modules/aws_msk_cluster.py
plugins/modules/aws_secret.py
plugins/modules/aws_step_functions_state_machine.py
plugins/modules/dynamodb_table.py
plugins/modules/ec2_eip.py
plugins/modules/ec2_transit_gateway_vpc_attachment.py
plugins/modules/ec2_vpc_peer.py
plugins/modules/elb_application_lb.py
plugins/modules/elb_network_lb.py
plugins/modules/iam_role.py
plugins/modules/iam_user.py
plugins/modules/networkfirewall.py
plugins/modules/networkfirewall_policy.py
plugins/modules/networkfirewall_rule_group.py
plugins/modules/rds_cluster.py
plugins/modules/rds_instance.py
plugins/modules/rds_instance_snapshot.py
plugins/modules/rds_option_group.py
plugins/modules/rds_subnet_group.py
plugins/modules/redshift.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@b11ffae
…collections#1459)

Update extends_documentation_fragment with amazon.aws.boto3

Depends-On: ansible/ansible-zuul-jobs#1654
SUMMARY

As per ansible-collections#985 add amazon.aws.boto3.

ISSUE TYPE

Docs Pull Request

COMPONENT NAME

several

Reviewed-by: Jill R <None>
Reviewed-by: Mark Chappell <None>
Reviewed-by: Markus Bergholz <[email protected]>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@bd3c03f
iam_role: drop deprecation

SUMMARY
The change was announced since community.aws 1.0.0 for ansible 2.14
With community.aws 2.1.0, it was changed to the date after 2022-06-01
However, in the meantime the standard value is true for purge parameters. Therefore we just drop the deprecation warning.
COMPONENT NAME
iam_role

Reviewed-by: Mark Chappell <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@75ba63b
…ons#1632)

Ansible User-Agent identification for community.aws

SUMMARY

The value will be similar to this APN/1.0 Ansible/2.14.1 community.aws/6.0.0-dev0

ISSUE TYPE

Feature Pull Request

Reviewed-by: Mark Chappell <None>
Reviewed-by: Bikouo Aubin <None>
Reviewed-by: Alina Buzachis <None>

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@a8cbce2
@github-actions
Copy link

github-actions bot commented Sep 20, 2023

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/6317f6aff4ce40adaab6397c29feeb45

✔️ ansible-galaxy-importer SUCCESS in 5m 01s
✔️ build-ansible-collection SUCCESS in 12m 29s
✔️ ansible-test-splitter SUCCESS in 6m 02s
✔️ integration-amazon.aws-1 SUCCESS in 6m 12s
✔️ integration-amazon.aws-2 SUCCESS in 7m 42s
✔️ integration-community.aws-1 SUCCESS in 6m 26s
Skipped 41 jobs

Copy link
Contributor

@tremble tremble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration, +1

Deprecations/Removals:
a) I don't like pulling this into the migration PR (too much changing at once)
b) Missing breaking changelog entry
c) Last time I spoke to @alinabuzachis 7.0.0 is hopefully landing early November (to meet the Ansible 9 release deadline), since the advertised date on the deprecation was 2023-12-01, we shouldn't include this in 7.0.0

Please clean-up the "new" commits (those that weren't from community.aws). We need to remember to manually merge with commit without squashing too.

changelogs/fragments/migrate_iam_role.yml Outdated Show resolved Hide resolved
changelogs/fragments/migrate_iam_role.yml Outdated Show resolved Hide resolved
@abikouo
Copy link
Contributor Author

abikouo commented Sep 22, 2023

Migration, +1

Deprecations/Removals: a) I don't like pulling this into the migration PR (too much changing at once) b) Missing breaking changelog entry c) Last time I spoke to @alinabuzachis 7.0.0 is hopefully landing early November (to meet the Ansible 9 release deadline), since the advertised date on the deprecation was 2023-12-01, we shouldn't include this in 7.0.0

Please clean-up the "new" commits (those that weren't from community.aws). We need to remember to manually merge with commit without squashing too.

Pull request has been restricted to the code and tests migration, other (deprecation, unit tests) will follow later on another PR. The new commits have been squashed

@abikouo abikouo requested a review from tremble September 22, 2023 06:09
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/3c7d635a89c14779b34cb96fb3146996

✔️ ansible-galaxy-importer SUCCESS in 4m 41s
✔️ build-ansible-collection SUCCESS in 12m 57s
✔️ ansible-test-splitter SUCCESS in 5m 01s
✔️ integration-amazon.aws-1 SUCCESS in 8m 14s
✔️ integration-community.aws-1 SUCCESS in 8m 27s
Skipped 42 jobs

plugins/modules/iam_role.py Outdated Show resolved Hide resolved
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/df03205d068943ddbb92997b0c8116ec

✔️ ansible-galaxy-importer SUCCESS in 5m 36s
✔️ build-ansible-collection SUCCESS in 12m 35s
✔️ ansible-test-splitter SUCCESS in 4m 59s
✔️ integration-amazon.aws-1 SUCCESS in 6m 17s
✔️ integration-community.aws-1 SUCCESS in 7m 55s
Skipped 42 jobs

@abikouo abikouo added the mergeit Merge the PR (SoftwareFactory) label Sep 26, 2023
@abikouo abikouo dismissed tremble’s stale review September 26, 2023 12:42

changes addressed

@abikouo abikouo added mergeit Merge the PR (SoftwareFactory) and removed mergeit Merge the PR (SoftwareFactory) labels Sep 27, 2023
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).
https://ansible.softwarefactory-project.io/zuul/buildset/8cb605cfe7d84eef958a7f87926dc7c8

✔️ ansible-galaxy-importer SUCCESS in 6m 05s
✔️ build-ansible-collection SUCCESS in 12m 21s
✔️ ansible-test-splitter SUCCESS in 4m 41s
✔️ integration-amazon.aws-1 SUCCESS in 6m 25s
✔️ integration-community.aws-1 SUCCESS in 7m 03s
Skipped 42 jobs

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit e109f32 into ansible-collections:main Sep 27, 2023
86 of 121 checks passed
softwarefactory-project-zuul bot pushed a commit to ansible-collections/community.aws that referenced this pull request Sep 28, 2023
Migrate modules iam_role and iam_role_info to amazon.aws

Since ansible-collections/amazon.aws#1760 has been merged, this is ready for review too
Migrate modules iam_role and iam_role_info to collection amazon.aws

Remove modules codes and tests
Update runtime.yml for redirection

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

iam_role
iam_role_info

Reviewed-by: Alina Buzachis
alinabuzachis pushed a commit to alinabuzachis/community.aws that referenced this pull request Oct 2, 2023
…lections#1948)

Migrate modules iam_role and iam_role_info to amazon.aws

Since ansible-collections/amazon.aws#1760 has been merged, this is ready for review too
Migrate modules iam_role and iam_role_info to collection amazon.aws

Remove modules codes and tests
Update runtime.yml for redirection

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

iam_role
iam_role_info

Reviewed-by: Alina Buzachis
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this pull request Oct 2, 2023
Migrate iam_role* modules and tests

SUMMARY
Migrate modules iam_role and iam_role_info from community.aws
ISSUE TYPE
New Module Pull Request

COMPONENT NAME
iam_role
iam_role_info

Reviewed-by: Mark Chappell
Reviewed-by: Alina Buzachis
alinabuzachis added a commit to alinabuzachis/amazon.aws that referenced this pull request Oct 6, 2023
gravesm pushed a commit that referenced this pull request Oct 6, 2023
abikouo pushed a commit to abikouo/amazon.aws that referenced this pull request Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergeit Merge the PR (SoftwareFactory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.