• Resource Template Service

rts
  1. Help Center
  2. Resource Template Service
  3. User Guide
  4. Template Grammar
  5. Template Structure

Template Structure

Templates are used to create stacks and are blueprints that describe the infrastructure and architecture. The template editor defines resource requirements and configuration details in the template and describes the dependencies between resources.

A template must be a YAML formatted text file. A template file contains the following sections:

heat_template_version: xxxx-xx-xx
# Indicates the template version. This section is mandatory.
description:
# Provides supplementary information about the template. This section is optional.
parameter_groups:
# Indicates the parameter group that specifies the parameter sequence. This section is optional.
parameters:
# Indicates the parameters to be entered. This section is optional.
resources:
# Indicates the template resources. This section is optional.
outputs:
# Indicates the output of created resources. This section is optional.
conditions:
# Indicates the conditions that must be met during stack creation and update. This section is optional.

The following is an example template for creating an ECS VM.

heat_template_version: 2013-05-23

description: Simple template to deploy a single compute instance

parameters:
  key_name:
    type: string
    label: Key Name
    description: Name of key-pair to be used for compute instance
  image_id:
    type: string
    label: Image ID
    description: Image to be used for compute instance
  instance_type:
    type: string
    label: Instance Type
    description: Type of instance (flavor) to be used
  net_id:
    type: string
    label: Network UUID
    description: The network to be used

resources:
  my_instance:
    type: OS::Nova::Server
    properties:
      key_name: { get_param: key_name }
      image: { get_param: image_id }
      flavor: { get_param: instance_type }
      networks: [ { network: { get_param: net_id } } ]

Description:

heat_template_version: This key with value 2013-05-23 (or a later date) indicates that the YAML document is a HOT template of the specified version.

description: This optional key allows for giving a description of the template, or the workload that can be deployed using the template.

parameters: This section defines involved parameters, which may be invoked by internal function get_param when you define resource attributes in the subsequent operations. The section is optional and can be omitted when no input is required.

resources: This section defines all resources required by service orchestration and defines dependencies. The field is a core section in the template file . type indicates the resource type.