[openstack-dev] [Heat] Referencing VPC resources across templates

Simon Pasquier pasquier.simon at gmail.com
Wed Apr 3 07:29:03 UTC 2013


Hi,

Let say I have a first template to create a VPC network and another one to
create a subnet associated to that VPC.

First template:
{
   "AWSTemplateFormatVersion" : "2010-09-09",
   "Resources" : {
      "myVPC" : {
         "Type" : "AWS::EC2::VPC",
         "Properties" : {
            "CidrBlock" : "20.0.0.0/16"
         }
      }
   },
   "Outputs" : {
    "VpcID" : {
      "Value" : { "Ref" : "myVPC" },
      "Description" : "Reference of the myVPC"
    }
   }
}

Second template:
{
   "AWSTemplateFormatVersion" : "2010-09-09",

   "Parameters" : {
    "VpcId" : {
      "Type" : "String",
      "Description" : "VpcId of your existing Virtual Private Cloud (VPC)"
    }
   },

   "Resources" : {
    "mySubnet" : {
         "Type" : "AWS::EC2::Subnet",
         "Properties" : {
            "VpcId" : { "Ref" : "VpcId" },
            "CidrBlock" : "20.0.0.0/24",
            "AvailabilityZone" : "us-east-1a"
         }
      }
   },
   "Outputs" : {
    "SubnetId" : {
      "Value" : { "Ref" : "mySubnet" },
      "Description" : "Reference to mySubnet"
    }
   }
}


I want to pass the VpcId value as a parameter to the second template but
the stack creation fails. Looking at the code, this use case doesn't seem
to be supported.
Am I right? If yes, is it something planned for a future release?
Thanks,
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20130403/d91591a6/attachment.html>


More information about the OpenStack-dev mailing list