[Openstack] How to reference one template from another

Steven Hardy shardy at redhat.com
Mon Jun 2 20:19:45 UTC 2014


Hi Mike,

On Mon, Jun 02, 2014 at 03:13:07PM -0400, Mike Spreitzer wrote:
>    In a file directory I have Heat Orchestration Template A.yaml, which
>    includes a resource named N of type AWS::CloudFormation::Stack, for which
>    I want to use the Heat Orchestration Template in file B.yaml (in the same
>    directory).  What do I write in the properties of N, and in the `heat
>    stack-create` command line, to make this work?

This is one of the drawbacks of the AWS-compatible interface to nested
stacks, it requires a URL not a local file, so basically you can't.

I would reccomend using one of the native interfaces to nested stacks
instead:

1. untyped nested stack

resources:
  instance:
    type: b.yaml
    properties:
        <properties are the parameters defined in b.yaml

To launch you must use the heat CLI, and python-heatclient will resolve
b.yaml from the local directory and add the body to the API request to heat
which creates the stack.

2. Provider resource

Provider resources enable you to specify a type alias for nested stacks:

resources:
  instance:
    type: My::Nested

With an environment file of:

resource_registry:
    My::Nested: b.yaml

More info and worked examples in this blog post:

http://hardysteven.blogspot.co.uk/2013/10/heat-providersenvironments-101-ive.html

Note that both interfaces are best used via the CLI atm due to bug #1322258
which needs to be resolved before nested stacks and environments will be
fully working via Horizon.

Steve




More information about the Openstack mailing list