Route53 backend should be global (#5414)

This commit is contained in:
Timothy Klopotoski 2022-08-23 09:45:01 -04:00 committed by GitHub
parent d2e6fa4cdb
commit 4e9fba5f28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -249,7 +249,7 @@ class RecordSet(CloudFormationModel):
def delete(self, account_id, region): # pylint: disable=unused-argument
"""Not exposed as part of the Route 53 API - used for CloudFormation"""
backend = route53_backends[account_id][region]
backend = route53_backends[account_id]["global"]
hosted_zone = backend.get_hosted_zone_by_name(self.hosted_zone_name)
if not hosted_zone:
hosted_zone = backend.get_hosted_zone(self.hosted_zone_id)

View File

@ -224,3 +224,21 @@ def test_route53_with_update():
record_set = rrsets[0]
record_set["ResourceRecords"][0]["Value"].should.equal("my_other.example.com")
@mock_cloudformation
@mock_route53
def test_delete_route53_recordset():
cf = boto3.client("cloudformation", region_name="us-west-1")
# given a stack with a record set
stack_name = "test_stack_recordset_delete"
template_json = json.dumps(route53_health_check.template)
cf.create_stack(StackName=stack_name, TemplateBody=template_json)
# when the stack is deleted
cf.delete_stack(StackName=stack_name)
# then it should not error