Route53 `change_resource_record_sets` delete calls succeed when it should fail
Description
Deleting a resource record set should require that we specify all the same values that we specified when we created it according to these docs.
If a record was created with Name, Type, TTL, and ResourceRecords, deleting should fail unless all of the values are specified. This is true in boto3, and missing TTL and ResourceRecords results in this error:
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=example.com, Type=A, SetIdentifier=null]
exit status 1
In moto, this succeeds. The code snippet below provides an example that should error at delete_call, but does not.
Steps to reproduce
import boto3
import moto
@moto.mock_route53
def test():
client = boto3.client("route53")
name = "example.com"
hosted_zone_id = client.create_hosted_zone(Name=name, CallerReference=name)["HostedZone"]["Id"]
create_call = client.change_resource_record_sets(
HostedZoneId=hosted_zone_id,
ChangeBatch={
"Changes": [
{
"Action": "DELETE",
"ResourceRecordSet": {
"Name": name,
"Type": "A",
"TTL": 300,
"ResourceRecords": [{"Value": "192.168.0.1"}],
},
}
]
},
)
waiter = client.get_waiter("resource_record_sets_changed")
waiter.wait(Id=create_call["ChangeInfo"]["Id"])
# This call should fail
delete_call = client.change_resource_record_sets(
HostedZoneId=hosted_zone_id,
ChangeBatch={
"Changes": [
{
"Action": "DELETE",
"ResourceRecordSet": {
"Name": name,
"Type": "A",
# Missing TTL and ResourceRecords
},
}
]
},
)
test()
delete_call should raise InvalidInput when insufficient arguments are provided.
Versions:
moto: 4.0.10 boto3: 1.17.59
Hi @k6l3, welcome to Moto! Thanks for raising this and for providing a reproducible test case.
Would you like to submit a PR for this yourself?
Bandwidth to fix is low; I'll raise a PR if I get the time but it may take a while.