The document provides the description of adding sub-templates in Murano HOT packages. It is possible to do a template composition by referencing some existing template by putting it file name into a "type" attribute of resource definition as if it was some real resource. To enable this use case sub-templates need to be placed in Resources/HotFiles. Change-Id: I1ce0d264d02456645cf59067075a980556ce0e98 Closes-Bug: #1579813
1.8 KiB
HOT packages
Hot packages with nested Heat templates
In Murano HOT packages it is possible to allow Heat nested templates to be saved and deployed as part of a Murano Heat applications. Such templates should be placed in package under ‘/Resources/HotFiles’. Adding additional templates to a package is optional. When a Heat generated package is being deployed, if there are any Heat nested templates located in the package under ‘/Resources/HotFiles’, they are sent to Heat together with the main template and params during stack creation.
These nested templates can be referenced by putting the template name
into the type
attribute of resource definition, in the main
template. This mechanism then compose one logical stack with these
multiple templates. The following examples illustrate how you can use a
custom template to define new types of resources. These examples use a
custom template stored in a sub_template.yaml
file
heat_template_version: 2015-04-30 parameters: key_name: type: string description: Name of a KeyPair resources: server: type: OS::Nova::Server properties: key_name: {get_param: key_name} flavor: m1.small image: ubuntu-trusty
Use the template filename as type
The following main template defines the
sub_template.yaml
file as value for the type property of a
resource
heat_template_version: 2015-04-30 resources: my_server: type: sub_template.yaml properties: key_name: my_key
Note
This feature is supported Liberty onwards.