Parameters Section

The parameters section defines the input parameters used when the template is instantiated.

For example, parameters specified by the user, such as name, password, and image ID.

As it is possible to specify the parameters when creating a stack, this means it is not necessary to define information such as passwords in the template. In the same way, by specifying the availability zone when creating a stack, it is possible to create stacks with the same configurations in multiple regions or availability zones using a single Heat template.

The type or default value is defined for each parameter, with the parameter name as the key.

parameters:
  <param name>:
    type: <string | number | json | comma_delimited_list>
    label: <human-readable name of the parameter>
    description: <description of the parameter>
    default: <default value for parameter>
    hidden: <true | false>
    constraints:
      <parameter constraints>
Element Required Description
<param name> Yes Defines the name of an input parameter.
type Yes

Defines the data type of an input parameter.

  • string
  • number
  • json
  • comma_delimited_list
label No Defines the human-readable label.
description No Defines the human-readable description.
default No Defines the default value used when input of the parameter is omitted.
hidden No

Defines whether to hide the parameter when a user requests information about a stack created from the template. This attribute can be used for passwords. If omitted, false will be used.

  • true
  • false
constraints No Defines the constraints of the parameter. Constraints are specified in the format described in the section below.

The defined parameters can be used in the "resources section" or the "outputs section".

(For the method for using parameters, refer to the "get_param" function that is explained later)

The following is an example of specifying the parameter (flavor) for the type (flavor) of the virtual server.

parameters:
...
  flavor:
    type: string
    description: Flavor for the server to be created
    default: T-1
...
resources:
  server:
    type: OS::Nova::Server
    properties:
      flavor: { get_param: flavor }
...

In the above example, T-1 is specified as the default value for the type (flavor) of the virtual server. If the flavor parameter is not specified when a stack is created, the flavor of created virtual servers will be T-1.