From e038cb304c4697915d6c129f985aa372df834096 Mon Sep 17 00:00:00 2001 From: Kevin Brebanov Date: Mon, 7 Jun 2021 10:41:05 -0400 Subject: [PATCH 1/3] route53: Prevent identifier from always being scrubbed. --- plugins/modules/route53.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/modules/route53.py b/plugins/modules/route53.py index d1391cfac58..d4fe99531c0 100644 --- a/plugins/modules/route53.py +++ b/plugins/modules/route53.py @@ -606,6 +606,7 @@ def main(): 'TTL': ttl_in, 'ResourceRecords': [dict(Value=value) for value in value_in], 'HealthCheckId': health_check_in, + 'SetIdentifier': identifier_in, }) if alias_in: From 83dd7bae9d2980b019abc416cd782cb65d19ff46 Mon Sep 17 00:00:00 2001 From: Kevin Brebanov Date: Thu, 16 Sep 2021 16:00:06 -0400 Subject: [PATCH 2/3] Add changelog fragment for pull request #595 --- changelogs/fragments/595-fix-route53-identifer.yaml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/595-fix-route53-identifer.yaml diff --git a/changelogs/fragments/595-fix-route53-identifer.yaml b/changelogs/fragments/595-fix-route53-identifer.yaml new file mode 100644 index 00000000000..11901c1655b --- /dev/null +++ b/changelogs/fragments/595-fix-route53-identifer.yaml @@ -0,0 +1,2 @@ +bugfixes: + - route53 - add missing set identifier in resource_record_set (https://github.com/ansible-collections/community.aws/pull/595). From fb3834327475a283cc80e30717d2bff16ab4ea53 Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 29 Sep 2021 20:33:10 +0200 Subject: [PATCH 3/3] Add integration tests --- .../targets/route53/tasks/main.yml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/tests/integration/targets/route53/tasks/main.yml b/tests/integration/targets/route53/tasks/main.yml index 18f10ae2987..ae80586dbe8 100644 --- a/tests/integration/targets/route53/tasks/main.yml +++ b/tests/integration/targets/route53/tasks/main.yml @@ -503,6 +503,42 @@ - alias_record is not failed - alias_record is not changed + - name: 'Create a weighted record' + route53: + state: present + zone: '{{ zone_one }}' + record: 'weighted.{{ zone_one }}' + type: CNAME + value: 'zid_test.{{ zone_one }}' + overwrite: True + identifier: "host1@www" + weight: 100 + region: '{{ omit }}' + register: weighted_record + - name: 'This should be changed' + assert: + that: + - weighted_record is not failed + - weighted_record is changed + + - name: 'Re-Create a weighted record' + route53: + state: present + zone: '{{ zone_one }}' + record: 'weighted.{{ zone_one }}' + type: CNAME + value: 'zid_test.{{ zone_one }}' + overwrite: True + identifier: "host1@www" + weight: 100 + region: '{{ omit }}' + register: weighted_record + - name: 'This should not be changed' + assert: + that: + - weighted_record is not failed + - weighted_record is not changed + always: - route53_info: query: record_sets @@ -521,6 +557,20 @@ loop: '{{ z1_records.ResourceRecordSets | selectattr("Type", "in", ["A", "AAAA", "CNAME", "CAA"]) | list }}' when: - '"AliasTarget" in item' + - name: 'Loop over A/AAAA/CNAME records and delete them' + route53: + state: absent + zone: '{{ zone_one }}' + record: '{{ item.Name }}' + type: '{{ item.Type }}' + value: '{{ item.ResourceRecords | map(attribute="Value") | join(",") }}' + identifier: '{{ item.SetIdentifier }}' + region: '{{ omit }}' + ignore_errors: True + loop: '{{ z1_records.ResourceRecordSets | selectattr("Type", "in", ["A", "AAAA", "CNAME", "CAA"]) | list }}' + when: + - '"ResourceRecords" in item' + - '"SetIdentifier" in item' - name: 'Loop over A/AAAA/CNAME records and delete them' route53: state: absent @@ -551,6 +601,21 @@ loop: '{{ z2_records.ResourceRecordSets | selectattr("Type", "in", ["A", "AAAA", "CNAME", "CAA"]) | list }}' when: - '"AliasTarget" in item' + - name: 'Loop over A/AAAA/CNAME records and delete them' + route53: + state: absent + zone: '{{ zone_two }}' + record: '{{ item.Name }}' + type: '{{ item.Type }}' + value: '{{ item.ResourceRecords | map(attribute="Value") | join(",") }}' + identifier: '{{ item.SetIdentifier }}' + region: '{{ omit }}' + private_zone: true + ignore_errors: True + loop: '{{ z2_records.ResourceRecordSets | selectattr("Type", "in", ["A", "AAAA", "CNAME", "CAA"]) | list }}' + when: + - '"ResourceRecords" in item' + - '"SetIdentifier" in item' - name: 'Loop over A/AAAA/CNAME records and delete them' route53: state: absent