Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

route53: Identifier missing from resource_record_set. #595

Merged
merged 3 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/595-fix-route53-identifer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- route53 - add missing set identifier in resource_record_set (https://github.com/ansible-collections/community.aws/pull/595).
1 change: 1 addition & 0 deletions plugins/modules/route53.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
65 changes: 65 additions & 0 deletions tests/integration/targets/route53/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down