-
Notifications
You must be signed in to change notification settings - Fork 399
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 cannot delete A record set #800
Comments
Solution would be to make TTL nullable.. and if null.. don't provide TTL in the request. |
I can confirm. However, just leaving it out makes botocore fail
So we must keep the TTL of the existing record. diff --git a/plugins/modules/route53.py b/plugins/modules/route53.py
index 9640202..e971e18 100644
--- a/plugins/modules/route53.py
+++ b/plugins/modules/route53.py
@@ -596,17 +596,29 @@ def main():
aws_record = get_record(route53, zone_id, record_in, type_in, identifier_in)
- resource_record_set = scrub_none_parameters({
- 'Name': record_in,
- 'Type': type_in,
- 'Weight': weight_in,
- 'Region': region_in,
- 'Failover': failover_in,
- 'TTL': ttl_in,
- 'ResourceRecords': [dict(Value=value) for value in value_in],
- 'HealthCheckId': health_check_in,
- 'SetIdentifier': identifier_in,
- })
+ if command_in is not 'delete':
+ resource_record_set = scrub_none_parameters({
+ 'Name': record_in,
+ 'Type': type_in,
+ 'Weight': weight_in,
+ 'Region': region_in,
+ 'Failover': failover_in,
+ 'TTL': ttl_in,
+ 'ResourceRecords': [dict(Value=value) for value in value_in],
+ 'HealthCheckId': health_check_in,
+ 'SetIdentifier': identifier_in,
+ })
+ else:
+ resource_record_set = scrub_none_parameters({
+ 'Name': record_in,
+ 'Type': type_in,
+ 'Weight': weight_in,
+ 'Region': region_in,
+ 'Failover': failover_in,
+ 'ResourceRecords': [dict(Value=value) for value in value_in],
+ 'HealthCheckId': health_check_in,
+ 'TTL': aws_record.get('TTL')
+ })
if alias_in:
resource_record_set['AliasTarget'] = dict( |
fix delete records without TTL SUMMARY Closes #800 ISSUE TYPE Bugfix Pull Request COMPONENT NAME route53 Reviewed-by: Mark Chappell <None> Reviewed-by: Felix Fontein <None> Reviewed-by: Tiger Kaovilai <tiger.k@redhat.com> Reviewed-by: Markus Bergholz <git@osuv.de> Reviewed-by: None <None>
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 <tiger.k@redhat.com> Reviewed-by: Markus Bergholz <git@osuv.de> Reviewed-by: None <None> This commit was initially merged in https://github.com/ansible-collections/community.aws See: ansible-collections@472776e
Summary
Cannot delete A record without or with TTL value
Providing TTL=null results in
When not providing TTL, module uses default of 3600
Providing default ttl result in
Relevant blogs: https://blog.ryanhalliday.com/2019/09/route53-aliastarget-invalid-request.html
Issue Type
Bug Report
Component Name
route53
Ansible Version
Collection Versions
AWS SDK versions
Configuration
$ ansible-config dump --only-changed
OS / Environment
macos
Steps to Reproduce
or leave empty ttl.. results in default ttl 3600 used
Expected Results
A record is deleted without TTL errors
Actual Results
ttl = null
ttl left to default
Code of Conduct
The text was updated successfully, but these errors were encountered: