From 1ec2100975b0f191032eb5f07a9558607a3f19d5 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 31 Mar 2021 14:16:16 +0200 Subject: [PATCH 1/4] rds_instance - preferred_maintenance_window - force day of week into lowercase --- plugins/modules/rds_instance.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/modules/rds_instance.py b/plugins/modules/rds_instance.py index 0dae125889b..6e1312b739b 100644 --- a/plugins/modules/rds_instance.py +++ b/plugins/modules/rds_instance.py @@ -1214,6 +1214,10 @@ def main(): if module.params['processor_features'] is not None: module.params['processor_features'] = dict((k, to_text(v)) for k, v in module.params['processor_features'].items()) + # Ensure dates are in lowercase + if module.params['preferred_maintenance_window']: + module.params['preferred_maintenance_window'] = module.params['preferred_maintenance_window'].lower() + client = module.client('rds') changed = False state = module.params['state'] From 5730df2e70da6272914aa3956dbbb01a164e98d0 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 31 Mar 2021 14:17:21 +0200 Subject: [PATCH 2/4] add integration test --- .../rds_instance/tasks/test_modification.yml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/integration/targets/rds_instance/tasks/test_modification.yml b/tests/integration/targets/rds_instance/tasks/test_modification.yml index 4c1d28e7ec8..fab7647af3e 100644 --- a/tests/integration/targets/rds_instance/tasks/test_modification.yml +++ b/tests/integration/targets/rds_instance/tasks/test_modification.yml @@ -153,6 +153,34 @@ - '"db_instance_class" in result.pending_modified_values or result.db_instance_class == "db.t2.medium"' - '"engine_version" in result.pending_modified_values or result.engine_version == "10.2.21"' + - name: Idempotence modifying several pending attributes - preferred_maintenance_window not lowercase + rds_instance: + id: '{{ instance_id }}' + state: present + allocated_storage: 30 + db_instance_class: "{{ modified_db_instance_class }}" + backup_retention_period: 2 + preferred_backup_window: "05:00-06:00" + preferred_maintenance_window: "Mon:06:20-Mon:06:50" + engine_version: "10.2.21" + allow_major_version_upgrade: true + auto_minor_version_upgrade: false + port: 1150 + max_allocated_storage: 100 + register: result + retries: 30 + delay: 10 + until: result is not failed + + - assert: + that: + - not result.changed + - '"allocated_storage" in result.pending_modified_values or result.allocated_storage == 30' + - '"max_allocated_storage" in result.pending_modified_values or result.max_allocated_storage == 100' + - '"port" in result.pending_modified_values or result.endpoint.port == 1150' + - '"db_instance_class" in result.pending_modified_values or result.db_instance_class == "db.t2.medium"' + - '"engine_version" in result.pending_modified_values or result.engine_version == "10.2.21"' + - name: Delete the instance rds_instance: id: '{{ instance_id }}' From 713219bd1dbcca9531a08cdcbb01fa01c3124248 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 31 Mar 2021 14:23:25 +0200 Subject: [PATCH 3/4] changelog --- changelogs/516-rds_instance-preferred_maintenance_window.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/516-rds_instance-preferred_maintenance_window.yml diff --git a/changelogs/516-rds_instance-preferred_maintenance_window.yml b/changelogs/516-rds_instance-preferred_maintenance_window.yml new file mode 100644 index 00000000000..42f789e1ffb --- /dev/null +++ b/changelogs/516-rds_instance-preferred_maintenance_window.yml @@ -0,0 +1,2 @@ +minor_changes: +- rds_instance - convert ``preferred_maintenance_window`` days into lowercase so changed returns properly (https://github.com/ansible-collections/community.aws/pull/515). From 082d8d6f864ea949986d22920de896c8101d64ba Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 7 Apr 2021 14:10:41 +0200 Subject: [PATCH 4/4] Update changelogs/516-rds_instance-preferred_maintenance_window.yml --- changelogs/516-rds_instance-preferred_maintenance_window.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/516-rds_instance-preferred_maintenance_window.yml b/changelogs/516-rds_instance-preferred_maintenance_window.yml index 42f789e1ffb..c986d684cbc 100644 --- a/changelogs/516-rds_instance-preferred_maintenance_window.yml +++ b/changelogs/516-rds_instance-preferred_maintenance_window.yml @@ -1,2 +1,2 @@ minor_changes: -- rds_instance - convert ``preferred_maintenance_window`` days into lowercase so changed returns properly (https://github.com/ansible-collections/community.aws/pull/515). +- rds_instance - convert ``preferred_maintenance_window`` days into lowercase so changed returns properly (https://github.com/ansible-collections/community.aws/pull/516).