From 474044ceb5088227d0e1bdaf0ec6eeea86273164 Mon Sep 17 00:00:00 2001 From: Markus Bergholz Date: Mon, 22 Nov 2021 17:37:43 +0100 Subject: [PATCH] fix delete records without TTL (#801) fix delete records without TTL SUMMARY Closes #800 ISSUE TYPE Bugfix Pull Request COMPONENT NAME route53 Reviewed-by: Mark Chappell Reviewed-by: Felix Fontein Reviewed-by: Tiger Kaovilai Reviewed-by: Markus Bergholz Reviewed-by: None --- route53.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/route53.py b/route53.py index 17ed261aa14..4275d65b684 100644 --- a/route53.py +++ b/route53.py @@ -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: @@ -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=[ @@ -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(