Repository: getmoto/moto

Issue:
Resources in mentioned in cloud formation template is not getting created.
Hi,
I am creating security group through cloud formation template and then trying to retrieve that through boto client but it says that security group does not exists. If i create security group through command line then i am able to fetch it.
It seems like resources in cloud formation does not get created when we deploy it.



Discussion:
Can we get a test case that shows this failing.
Hi, 
I debuged and found out the reason. In case of route53 models.py in moto, physical_resource_id is returning as name of resource but it should have been id of resource. 

Ahh if you havent already I can PR that later.

Resolving patch:
diff --git a/moto/route53/models.py b/moto/route53/models.py
--- a/moto/route53/models.py
+++ b/moto/route53/models.py
@@ -209,7 +209,7 @@ def get_record_sets(self, type_filter, name_filter):
 
     @property
     def physical_resource_id(self):
-        return self.name
+        return self.id
 
     @classmethod
     def create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):


Test patch:
diff --git a/tests/test_cloudformation/fixtures/route53_ec2_instance_with_public_ip.py b/tests/test_cloudformation/fixtures/route53_ec2_instance_with_public_ip.py
--- a/tests/test_cloudformation/fixtures/route53_ec2_instance_with_public_ip.py
+++ b/tests/test_cloudformation/fixtures/route53_ec2_instance_with_public_ip.py
@@ -1,6 +1,13 @@
 from __future__ import unicode_literals
 
 template = {
+    "Parameters": {
+        "R53ZoneName": {
+            "Type": "String",
+            "Default": "my_zone"
+        }
+    },
+
     "Resources": {
         "Ec2Instance": {
             "Type": "AWS::EC2::Instance",
@@ -13,20 +20,20 @@
         "HostedZone": {
             "Type": "AWS::Route53::HostedZone",
             "Properties": {
-                "Name": "my_zone"
+                "Name": {"Ref": "R53ZoneName"}
             }
         },
 
         "myDNSRecord": {
             "Type": "AWS::Route53::RecordSet",
             "Properties": {
-                "HostedZoneName": {"Ref": "HostedZone"},
+                "HostedZoneId": {"Ref": "HostedZone"},
                 "Comment": "DNS name for my instance.",
                 "Name": {
                     "Fn::Join": ["", [
                         {"Ref": "Ec2Instance"}, ".",
                         {"Ref": "AWS::Region"}, ".",
-                        {"Ref": "HostedZone"}, "."
+                        {"Ref": "R53ZoneName"}, "."
                     ]]
                 },
                 "Type": "A",
diff --git a/tests/test_cloudformation/fixtures/route53_health_check.py b/tests/test_cloudformation/fixtures/route53_health_check.py
--- a/tests/test_cloudformation/fixtures/route53_health_check.py
+++ b/tests/test_cloudformation/fixtures/route53_health_check.py
@@ -26,7 +26,7 @@
         "myDNSRecord": {
             "Type": "AWS::Route53::RecordSet",
             "Properties": {
-                "HostedZoneName": {"Ref": "HostedZone"},
+                "HostedZoneId": {"Ref": "HostedZone"},
                 "Comment": "DNS name for my instance.",
                 "Name": "my_record_set",
                 "Type": "A",
diff --git a/tests/test_cloudformation/fixtures/route53_roundrobin.py b/tests/test_cloudformation/fixtures/route53_roundrobin.py
--- a/tests/test_cloudformation/fixtures/route53_roundrobin.py
+++ b/tests/test_cloudformation/fixtures/route53_roundrobin.py
@@ -5,30 +5,37 @@
 
     "Description": "AWS CloudFormation Sample Template Route53_RoundRobin: Sample template showing how to use weighted round robin (WRR) DNS entried via Amazon Route 53. This contrived sample uses weighted CNAME records to illustrate that the weighting influences the return records. It assumes that you already have a Hosted Zone registered with Amazon Route 53. **WARNING** This template creates one or more AWS resources. You will be billed for the AWS resources used if you create a stack from this template.",
 
+    "Parameters": {
+        "R53ZoneName": {
+            "Type": "String",
+            "Default": "my_zone"
+        }
+    },
+
     "Resources": {
 
         "MyZone": {
             "Type": "AWS::Route53::HostedZone",
             "Properties": {
-                "Name": "my_zone"
+                "Name": {"Ref": "R53ZoneName"}
             }
         },
 
         "MyDNSRecord": {
             "Type": "AWS::Route53::RecordSetGroup",
             "Properties": {
-                "HostedZoneName": {"Ref": "MyZone"},
+                "HostedZoneId": {"Ref": "MyZone"},
                 "Comment": "Contrived example to redirect to aws.amazon.com 75% of the time and www.amazon.com 25% of the time.",
                 "RecordSets": [{
                     "SetIdentifier": {"Fn::Join": [" ", [{"Ref": "AWS::StackName"}, "AWS"]]},
-                    "Name": {"Fn::Join": ["", [{"Ref": "AWS::StackName"}, ".", {"Ref": "AWS::Region"}, ".", {"Ref": "MyZone"}, "."]]},
+                    "Name": {"Fn::Join": ["", [{"Ref": "AWS::StackName"}, ".", {"Ref": "AWS::Region"}, ".", {"Ref": "R53ZoneName"}, "."]]},
                     "Type": "CNAME",
                     "TTL": "900",
                     "ResourceRecords": ["aws.amazon.com"],
                     "Weight": "3"
                 }, {
                     "SetIdentifier": {"Fn::Join": [" ", [{"Ref": "AWS::StackName"}, "Amazon"]]},
-                    "Name": {"Fn::Join": ["", [{"Ref": "AWS::StackName"}, ".", {"Ref": "AWS::Region"}, ".", {"Ref": "MyZone"}, "."]]},
+                    "Name": {"Fn::Join": ["", [{"Ref": "AWS::StackName"}, ".", {"Ref": "AWS::Region"}, ".", {"Ref": "R53ZoneName"}, "."]]},
                     "Type": "CNAME",
                     "TTL": "900",
                     "ResourceRecords": ["www.amazon.com"],