Skip to content

Commit

Permalink
fix delete records without TTL (ansible-collections#801)
Browse files Browse the repository at this point in the history
fix delete records without TTL

SUMMARY
Closes ansible-collections#800
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
route53

Reviewed-by: Mark Chappell <None>
Reviewed-by: Felix Fontein <None>
Reviewed-by: Tiger Kaovilai <[email protected]>
Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: None <None>
  • Loading branch information
markuman authored Nov 22, 2021
1 parent 22c7f6f commit 474044c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions route53.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
value:
description:
- The new value when creating a DNS record. YAML lists or multiple comma-spaced values are allowed for non-alias records.
- When deleting a record all values for the record must be specified or Route 53 will not delete it.
type: list
elements: str
overwrite:
Expand Down Expand Up @@ -513,8 +512,6 @@ def main():
required_if=(
('state', 'present', ['value']),
('state', 'create', ['value']),
('state', 'absent', ['value']),
('state', 'delete', ['value']),
),
# failover, region and weight are mutually exclusive
mutually_exclusive=[
Expand Down Expand Up @@ -607,6 +604,10 @@ def main():
'HealthCheckId': health_check_in,
'SetIdentifier': identifier_in,
})
if command_in == 'delete' and aws_record is not None:
resource_record_set['TTL'] = aws_record.get('TTL')
if not resource_record_set['ResourceRecords']:
resource_record_set['ResourceRecords'] = aws_record.get('ResourceRecords')

if alias_in:
resource_record_set['AliasTarget'] = dict(
Expand Down

0 comments on commit 474044c

Please sign in to comment.