diff --git a/changelogs/fragments/20240810-rds_instance-performance_insights_kms_key_id.yml b/changelogs/fragments/20240810-rds_instance-performance_insights_kms_key_id.yml new file mode 100644 index 00000000000..f1870df3d17 --- /dev/null +++ b/changelogs/fragments/20240810-rds_instance-performance_insights_kms_key_id.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - rds_instance - snake case for parameter ``performance_insights_kms_key_id`` was incorrect according to boto documentation (https://github.com/ansible-collections/amazon.aws/pull/2163). \ No newline at end of file diff --git a/plugins/module_utils/rds.py b/plugins/module_utils/rds.py index be34032c35d..148c81f8a8d 100644 --- a/plugins/module_utils/rds.py +++ b/plugins/module_utils/rds.py @@ -531,7 +531,7 @@ def get_snapshot(client, snapshot_identifier: str, snapshot_type: str, convert_t snapshot = snapshots[0] if snapshot and convert_tags: - snapshot["Tags"] = boto3_tag_list_to_ansible_dict(snapshot.pop("TagList")) + snapshot["Tags"] = boto3_tag_list_to_ansible_dict(snapshot.pop("TagList", None)) return snapshot @@ -576,8 +576,15 @@ def arg_spec_to_rds_params(options_dict: Dict[str, Any]) -> Dict[str, Any]: has_processor_features = True processor_features = options_dict.pop("processor_features") camel_options = snake_dict_to_camel_dict(options_dict, capitalize_first=True) + aws_replace_keys = ( + ("Db", "DB"), + ("Iam", "IAM"), + ("Az", "AZ"), + ("Ca", "CA"), + ("PerformanceInsightsKmsKeyId", "PerformanceInsightsKMSKeyId"), + ) for key in list(camel_options.keys()): - for old, new in (("Db", "DB"), ("Iam", "IAM"), ("Az", "AZ"), ("Ca", "CA")): + for old, new in aws_replace_keys: if old in key: camel_options[key.replace(old, new)] = camel_options.pop(key) camel_options["Tags"] = tags diff --git a/plugins/modules/rds_instance.py b/plugins/modules/rds_instance.py index d6246b5dfaf..cd899f774ee 100644 --- a/plugins/modules/rds_instance.py +++ b/plugins/modules/rds_instance.py @@ -1142,6 +1142,14 @@ def get_options_with_changing_values(client, module: AnsibleAWSModule, parameter # must be always specified when changing iops parameters["AllocatedStorage"] = new_allocated_storage + instance_performance_insights_kms_key_id = instance.get("PerformanceInsightsKMSKeyId") + if instance_performance_insights_kms_key_id == module.params.get( + "performance_insights_kms_key_id" + ) or instance_performance_insights_kms_key_id.split("/")[-1] == module.params.get( + "performance_insights_kms_key_id" + ): + parameters.pop("PerformanceInsightsKMSKeyId", None) + if parameters.get("NewDBInstanceIdentifier") and instance.get("PendingModifiedValues", {}).get( "DBInstanceIdentifier" ):