Skip to content

Commit

Permalink
Merge pull request ansible-collections#595 from kbrebanov/fix-route53…
Browse files Browse the repository at this point in the history
…-identifier

route53: Identifier missing from resource_record_set.

SUMMARY

Currently, the identifier parameter is never included in resource_record_set.

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

route53
ADDITIONAL INFORMATION


The identifier parameter is always nullified as it's not included in resource_record_set.
This change allows the identifier to be included and scrubbed if None.

Reviewed-by: Mark Chappell <None>
Reviewed-by: None <None>
  • Loading branch information
ansible-zuul[bot] authored Sep 29, 2021
2 parents 3fbca8f + fb38343 commit 4babc11
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
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

0 comments on commit 4babc11

Please sign in to comment.