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 cannot delete A record set without RRL #3161

Closed
omriman12 opened this issue Feb 21, 2022 · 4 comments
Closed

Route53 cannot delete A record set without RRL #3161

omriman12 opened this issue Feb 21, 2022 · 4 comments
Labels
guidance Question that needs advice or information. route53

Comments

@omriman12
Copy link

omriman12 commented Feb 21, 2022

Describe the bug
Cannot delete A record without or with TTL value.

Providing TTL=null results in:
An error occurred (InvalidInput) when calling the ChangeResourceRecordSets operation: Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=DELETE, Name=somedomain, Type=A, SetIdentifier=null]

When not providing TTL, module uses default of 3600
Providing default ttl result in:

An error occurred (InvalidChangeBatch) when calling the ChangeResourceRecordSets operation: [Tried to delete resource record set [name='somedomain.', type='A'] but the rdata provided is invalid]

I have noticed a similar issue created here in ansible repo:
ansible-collections/community.aws#800

@omriman12 omriman12 added the needs-triage This issue or PR still needs to be triaged. label Feb 21, 2022
@kdaily kdaily added guidance Question that needs advice or information. and removed needs-triage This issue or PR still needs to be triaged. labels Feb 21, 2022
@kdaily
Copy link
Member

kdaily commented Feb 21, 2022

Hi @omriman12,

Sorry to hear you're having an issue. I would need to see the debug logs generated when you turn on debugging with boto3.set_stream_logger('') to look at the request and response. Please redact any sensitive information from them. Thanks!

@kdaily kdaily added the response-requested Waiting on additional information or feedback. label Feb 21, 2022
@omriman12
Copy link
Author

omriman12 commented Feb 22, 2022

@kdaily here are the debug logs:

2022-02-22 13:06:23,372 botocore.hooks [DEBUG] Event before-parameter-build.route-53.ChangeResourceRecordSets: calling handler <function fix_route53_ids at 0x10ee97940>
2022-02-22 13:06:23,373 botocore.handlers [DEBUG] HostedZoneId *** -> ***
2022-02-22 13:06:23,373 botocore.hooks [DEBUG] Event before-parameter-build.route-53.ChangeResourceRecordSets: calling handler <function generate_idempotent_uuid at 0x10ee90a60>
2022-02-22 13:06:23,375 botocore.hooks [DEBUG] Event before-call.route-53.ChangeResourceRecordSets: calling handler <function inject_api_version_header_if_needed at 0x10ee96310>
2022-02-22 13:06:23,375 botocore.endpoint [DEBUG] Making request for OperationModel(name=ChangeResourceRecordSets) with params: {'url_path': '/2013-04-01/hostedzone/***/rrset/', 'query_string': {}, 'method': 'POST', 'headers': {'User-Agent': 'Boto3/1.18.58 Python/3.8.9 Darwin/20.6.0 Botocore/1.21.58'}, 'body': b'<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><ChangeBatch><Changes><Change><Action>DELETE</Action><ResourceRecordSet><Name>*****</Name><Type>A</Type><ResourceRecords><ResourceRecord><Value>*****</Value></ResourceRecord></ResourceRecords></ResourceRecordSet></Change></Changes></ChangeBatch></ChangeResourceRecordSetsRequest>', 'url': 'https://route53.amazonaws.com/2013-04-01/hostedzone/***/rrset/', 'context': {'client_region': 'aws-global', 'client_config': <botocore.config.Config object at 0x10f38b8b0>, 'has_streaming_input': False, 'auth_type': None}}
2022-02-22 13:06:23,376 botocore.hooks [DEBUG] Event request-created.route-53.ChangeResourceRecordSets: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x10f38b6d0>>
2022-02-22 13:06:23,376 botocore.hooks [DEBUG] Event choose-signer.route-53.ChangeResourceRecordSets: calling handler <function set_operation_specific_signer at 0x10ee90940>
2022-02-22 13:06:23,377 botocore.auth [DEBUG] Calculating signature using v4 auth.
2022-02-22 13:06:23,378 botocore.auth [DEBUG] CanonicalRequest:
POST
/2013-04-01/hostedzone/***/rrset/
host:route53.amazonaws.com
28f6a999d10f815a7b3fc663716adebd8e05b692b19c0724f427f204d31df614
2022-02-22 13:06:23,378 botocore.auth [DEBUG] StringToSign:
AWS4-HMAC-SHA256
20220222T110623Z
20220222/us-east-1/route53/aws4_request
ecd60bdaebc39a24592b94042cec644f0a0b54943f8e7b7d9cebb5444e8018f3
2022-02-22 13:06:23,378 botocore.auth [DEBUG] Signature:
b187dd22373ccab18a6e0e59beb5114c9b3539ea06de84e3f76c7bde5df2ffc5
2022-02-22 13:06:23,380 botocore.httpsession [DEBUG] Certificate path: /.venv/lib/python3.8/site-packages/certifi/cacert.pem
2022-02-22 13:06:23,380 urllib3.connectionpool [DEBUG] Starting new HTTPS connection (1): route53.amazonaws.com:443
2022-02-22 13:06:24,147 urllib3.connectionpool [DEBUG] https://route53.amazonaws.com:443 "POST /2013-04-01/hostedzone/***/rrset/ HTTP/1.1" 400 483
2022-02-22 13:06:24,147 botocore.parsers [DEBUG] Response headers: {'x-amzn-RequestId': '250136ad-81e8-40c9-a9e3-af22abd1b31a', 'Content-Type': 'text/xml', 'Content-Length': '483', 'Date': 'Tue, 22 Feb 2022 11:06:24 GMT', 'Connection': 'close'}
2022-02-22 13:06:24,148 botocore.parsers [DEBUG] Response body:
b'<?xml version="1.0"?>\n<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><Error><Type>Sender</Type><Code>InvalidInput</Code><Message>Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=DELETE, Name=*****, Type=A, SetIdentifier=null]</Message></Error><RequestId>250136ad-81e8-40c9-a9e3-af22abd1b31a</RequestId></ErrorResponse>'
2022-02-22 13:06:24,151 botocore.parsers [DEBUG] Response headers: {'x-amzn-RequestId': '250136ad-81e8-40c9-a9e3-af22abd1b31a', 'Content-Type': 'text/xml', 'Content-Length': '483', 'Date': 'Tue, 22 Feb 2022 11:06:24 GMT', 'Connection': 'close'}
2022-02-22 13:06:24,152 botocore.parsers [DEBUG] Response body:
b'<?xml version="1.0"?>\n<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><Error><Type>Sender</Type><Code>InvalidInput</Code><Message>Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=DELETE, Name=*****, Type=A, SetIdentifier=null]</Message></Error><RequestId>250136ad-81e8-40c9-a9e3-af22abd1b31a</RequestId></ErrorResponse>'
2022-02-22 13:06:24,152 botocore.hooks [DEBUG] Event needs-retry.route-53.ChangeResourceRecordSets: calling handler <botocore.retryhandler.RetryHandler object at 0x10f3c8340>
2022-02-22 13:06:24,152 botocore.retryhandler [DEBUG] No retry needed.
Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1483, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/patches/audit/delete_bluetriton_audit_record.py", line 56, in <module>
    main()
  File "/patches/audit/delete_bluetriton_audit_record.py", line 34, in main
    response = client.change_resource_record_sets(
  File "/.venv/lib/python3.8/site-packages/botocore/client.py", line 388, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/.venv/lib/python3.8/site-packages/botocore/client.py", line 708, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidInput: An error occurred (InvalidInput) when calling the ChangeResourceRecordSets operation: Invalid request: Expected exactly one of [AliasTarget, all of [TTL, and ResourceRecords], or TrafficPolicyInstanceId], but found none in Change with [Action=DELETE, Name=*****, Type=A, SetIdentifier=null]

@github-actions github-actions bot removed the response-requested Waiting on additional information or feedback. label Feb 22, 2022
@kdaily
Copy link
Member

kdaily commented Mar 14, 2022

Apologies for the delay. According to the documentation (which is generated from the API documentation):

To delete a resource record set, you must specify all the same values that you specified when you created it.

So, TTL would be required, and you may not be able to use the default value.

Since this is the expected behavior, I'll close this out! If you have further questions on how the Route53 service works, I would suggest the re:Post forums, or to open a ticket with AWS support through the AWS Console. Thanks!

@kdaily kdaily added the route53 label Mar 14, 2022
@kdaily kdaily closed this as completed Mar 14, 2022
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information. route53
Projects
None yet
Development

No branches or pull requests

2 participants