diff --git a/changelogs/fragments/2214-rds_cluster-limit-params-sent-to-api-for-states.yml b/changelogs/fragments/2214-rds_cluster-limit-params-sent-to-api-for-states.yml new file mode 100644 index 00000000000..7ff50c509b4 --- /dev/null +++ b/changelogs/fragments/2214-rds_cluster-limit-params-sent-to-api-for-states.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - rds_cluster - Limit params sent to api call to DBClusterIdentifier when using state started or stopped (https://github.com/ansible-collections/amazon.aws/issues/2197). diff --git a/plugins/modules/rds_cluster.py b/plugins/modules/rds_cluster.py index 1b84c91d472..a09e5a4a799 100644 --- a/plugins/modules/rds_cluster.py +++ b/plugins/modules/rds_cluster.py @@ -1124,11 +1124,15 @@ def changing_cluster_options(modify_params, current_cluster): if module.params["state"] == "started": if current_cluster["Engine"] in ["mysql", "postgres"]: module.fail_json("Only aurora clusters can use the state started") + # start_db_cluster supports only DBClusterIdentifier + changing_params = {} changing_params["DBClusterIdentifier"] = db_cluster_id if module.params["state"] == "stopped": if current_cluster["Engine"] in ["mysql", "postgres"]: module.fail_json("Only aurora clusters can use the state stopped") + # stop_db_cluster supports only DBClusterIdentifier + changing_params = {} changing_params["DBClusterIdentifier"] = db_cluster_id return changing_params diff --git a/tests/integration/targets/rds_cluster_states/tasks/main.yml b/tests/integration/targets/rds_cluster_states/tasks/main.yml index 49a37561c00..699cba9a166 100644 --- a/tests/integration/targets/rds_cluster_states/tasks/main.yml +++ b/tests/integration/targets/rds_cluster_states/tasks/main.yml @@ -16,6 +16,7 @@ username: "{{ username }}" password: "{{ password }}" skip_final_snapshot: true + backup_retention_period: 3 register: _result_delete_db_cluster - ansible.builtin.assert: @@ -31,6 +32,7 @@ engine_mode: provisioned username: "{{ username }}" password: "{{ password }}" + backup_retention_period: 3 register: _result_create_source_db_cluster - ansible.builtin.assert: