From f6c7cc34231cfec004aaccf24e7529c39cb6e888 Mon Sep 17 00:00:00 2001 From: Markus Bergholz Date: Wed, 4 Jan 2023 09:44:49 +0100 Subject: [PATCH] iam_role: drop deprecation (#1636) 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 (cherry picked from commit 75ba63bec07d98e021fc204882c5b82c64027aeb) --- changelogs/fragments/iam_role_purge_policy.yml | 2 ++ plugins/modules/iam_role.py | 10 ++-------- 2 files changed, 4 insertions(+), 8 deletions(-) create mode 100644 changelogs/fragments/iam_role_purge_policy.yml diff --git a/changelogs/fragments/iam_role_purge_policy.yml b/changelogs/fragments/iam_role_purge_policy.yml new file mode 100644 index 00000000000..c9837d028d4 --- /dev/null +++ b/changelogs/fragments/iam_role_purge_policy.yml @@ -0,0 +1,2 @@ +minor_changes: + - iam_role - Drop deprecation warning, because the standard value for purge parametes is ``true`` (https://github.com/ansible-collections/community.aws/pull/1636). diff --git a/plugins/modules/iam_role.py b/plugins/modules/iam_role.py index cccc062a494..09a86a54e82 100644 --- a/plugins/modules/iam_role.py +++ b/plugins/modules/iam_role.py @@ -58,9 +58,9 @@ purge_policies: description: - When I(purge_policies=true) any managed policies not listed in I(managed_policies) will be detatched. - - By default I(purge_policies=true). In a release after 2022-06-01 this will be changed to I(purge_policies=false). type: bool aliases: ['purge_policy', 'purge_managed_policies'] + default: true state: description: - Create or remove the IAM role. @@ -448,8 +448,6 @@ def create_or_update_role(module, client): purge_tags = module.params.get('purge_tags') tags = ansible_dict_to_boto3_tag_list(module.params.get('tags')) if module.params.get('tags') else None purge_policies = module.params.get('purge_policies') - if purge_policies is None: - purge_policies = True managed_policies = module.params.get('managed_policies') if managed_policies: # Attempt to list the policies early so we don't leave things behind if we can't find them. @@ -665,7 +663,7 @@ def main(): boundary=dict(type='str', aliases=['boundary_policy_arn']), create_instance_profile=dict(type='bool', default=True), delete_instance_profile=dict(type='bool', default=False), - purge_policies=dict(type='bool', aliases=['purge_policy', 'purge_managed_policies']), + purge_policies=dict(default=True, type='bool', aliases=['purge_policy', 'purge_managed_policies']), tags=dict(type='dict', aliases=['resource_tags']), purge_tags=dict(type='bool', default=True), wait=dict(type='bool', default=True), @@ -676,10 +674,6 @@ def main(): required_if=[('state', 'present', ['assume_role_policy_document'])], supports_check_mode=True) - if module.params.get('purge_policies') is None: - module.deprecate('After 2022-06-01 the default value of purge_policies will change from true to false.' - ' To maintain the existing behaviour explicitly set purge_policies=true', date='2022-06-01', collection_name='community.aws') - if module.params.get('boundary'): if module.params.get('create_instance_profile'): module.fail_json(msg="When using a boundary policy, `create_instance_profile` must be set to `false`.")