From 8c631cbc0a9732dc9cd5749f924c0fa20eceb010 Mon Sep 17 00:00:00 2001 From: Stefan Horning Date: Sat, 8 Jun 2019 02:32:51 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20rds=5Finstance=20module=E2=80=A6=20(#5622?= =?UTF-8?q?0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix rds_instance module to run against an (older) existing RDS instance successfully * Only pop Iops param if no storage_type is given. If given and set to wrong type we get to the AWS client error that informs the user * Docs syntax fix * Fix typo in docs Co-Authored-By: stefanhorning --- lib/ansible/modules/cloud/amazon/rds_instance.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/rds_instance.py b/lib/ansible/modules/cloud/amazon/rds_instance.py index b598a8c155..d4e7b66b27 100644 --- a/lib/ansible/modules/cloud/amazon/rds_instance.py +++ b/lib/ansible/modules/cloud/amazon/rds_instance.py @@ -212,7 +212,7 @@ options: type: bool iops: description: - - The Provisioned IOPS (I/O operations per second) value. + - The Provisioned IOPS (I/O operations per second) value. Is only set when using I(storage_type) is set to io1. type: int kms_key_id: description: @@ -846,6 +846,8 @@ def get_options_with_changing_values(client, module, parameters): parameters.pop('MasterUserPassword', None) if cloudwatch_logs_enabled: parameters['CloudwatchLogsExportConfiguration'] = cloudwatch_logs_enabled + if not module.params['storage_type']: + parameters.pop('Iops') instance = get_instance(client, module, instance_id) updated_parameters = get_changing_options_with_inconsistent_keys(parameters, instance, purge_cloudwatch_logs) @@ -890,7 +892,8 @@ def get_current_attributes_with_inconsistent_keys(instance): options['DBParameterGroupName'] = [parameter_group['DBParameterGroupName'] for parameter_group in instance['DBParameterGroups']] options['AllowMajorVersionUpgrade'] = None options['EnableIAMDatabaseAuthentication'] = instance['IAMDatabaseAuthenticationEnabled'] - options['EnablePerformanceInsights'] = instance['PerformanceInsightsEnabled'] + # PerformanceInsightsEnabled is not returned on older RDS instances it seems + options['EnablePerformanceInsights'] = instance.get('PerformanceInsightsEnabled', False) options['MasterUserPassword'] = None options['NewDBInstanceIdentifier'] = instance['DBInstanceIdentifier']