diff --git a/plugins/modules/rds_instance.py b/plugins/modules/rds_instance.py index e93322cc61b..ea2e8ba11b1 100644 --- a/plugins/modules/rds_instance.py +++ b/plugins/modules/rds_instance.py @@ -842,8 +842,10 @@ def get_parameters(client, module, parameters, method_name): if parameters.get('ProcessorFeatures') == [] and not method_name == 'modify_db_instance': parameters.pop('ProcessorFeatures') - if method_name == 'create_db_instance' and parameters.get('Tags'): - parameters['Tags'] = ansible_dict_to_boto3_tag_list(parameters['Tags']) + if method_name == 'create_db_instance' or method_name == 'create_db_instance_read_replica': + if parameters.get('Tags'): + parameters['Tags'] = ansible_dict_to_boto3_tag_list(parameters['Tags']) + if method_name == 'modify_db_instance': parameters = get_options_with_changing_values(client, module, parameters) diff --git a/tests/integration/targets/rds_instance/tasks/test_read_replica.yml b/tests/integration/targets/rds_instance/tasks/test_read_replica.yml index 157fd10597e..3ed091b3dc8 100644 --- a/tests/integration/targets/rds_instance/tasks/test_read_replica.yml +++ b/tests/integration/targets/rds_instance/tasks/test_read_replica.yml @@ -39,6 +39,9 @@ db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" region: "{{ region_src }}" + tags: + Name: "{{ instance_id }}" + Created_by: Ansible rds_instance tests <<: *aws_connection_info register: source_db @@ -59,9 +62,20 @@ db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" region: "{{ region_dest }}" + tags: + Name: "{{ instance_id }}" + Created_by: Ansible rds_instance tests <<: *aws_connection_info register: result + - assert: + that: + - result.changed + - "result.db_instance_identifier == '{{ instance_id }}-replica'" + - "result.tags | length == 2" + - "result.tags.Name == '{{ instance_id }}'" + - "result.tags.Created_by == 'Ansible rds_instance tests'" + - name: Test idempotence with a read replica rds_instance: id: "{{ instance_id }}-replica" @@ -73,6 +87,9 @@ db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" region: "{{ region_dest }}" + tags: + Name: "{{ instance_id }}" + Created_by: Ansible rds_instance tests <<: *aws_connection_info register: result @@ -92,6 +109,9 @@ db_instance_class: "{{ db_instance_class }}" allocated_storage: "{{ allocated_storage }}" region: "{{ region_dest }}" + tags: + Name: "{{ instance_id }}" + Created_by: Ansible rds_instance tests <<: *aws_connection_info register: result