Route53: allow hosted zone id as well when creating record sets (#833)

* add test that creates r53 record set from hosted zone id (not name)

* pass test to enable creating record sets by hosted zone ids
This commit is contained in:
David Wilcox 2017-03-05 14:31:45 +11:00 committed by Steve Pulec
commit 8d737eb59d
2 changed files with 57 additions and 3 deletions

View file

@ -213,8 +213,11 @@ class RecordSetGroup(object):
def create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):
properties = cloudformation_json['Properties']
zone_name = properties["HostedZoneName"]
hosted_zone = route53_backend.get_hosted_zone_by_name(zone_name)
zone_name = properties.get("HostedZoneName")
if zone_name:
hosted_zone = route53_backend.get_hosted_zone_by_name(zone_name)
else:
hosted_zone = route53_backend.get_hosted_zone(properties["HostedZoneId"])
record_sets = properties["RecordSets"]
for record_set in record_sets:
hosted_zone.add_rrset(record_set)