Updated on 2023-08-11 GMT+08:00

get_input

The get_input function is generally used to obtain the values of input parameters in the inputs section of the template file. You can also reference system pseudo parameters. For details, see System Pseudo Parameters.

Syntax

get_input: [paramName ]

Parameter Description

Table 1 Parameter description

Parameter

Mandatory

Description

paramName

Yes

Name of the input parameter defined in the inputs section of the template file.

Return Value

Value of the parameter

Examples

The following shows how to use the get_input function to retrieve the value of a parameter in the inputs section:

tosca_definitions_version: huaweicloud_tosca_version_1_0
inputs:
  name:
    default: test-vpc
  cidr:
    default: 10.0.0.0/8  
node_templates:
  my-first-vpc:
    type: HuaweiCloud.VPC.VPC
    properties:
      name: {get_input: name}
      cidr: {get_input: cidr}

System Pseudo Parameters

In addition to the parameters defined in the template, the get_input function can also reference system pseudo parameters. Currently, the following system pseudo parameters are supported:
  • HuaweiCloud.UserId: obtains the user ID of the current stack creator.
  • HuaweiCloud.ProjectId: obtains the ID of the project to which the current stack belongs.
  • HuaweiCloud.DomainId: obtains the ID of the tenant to which the current stack belongs.
  • HuaweiCloud.Region: obtains the ID of the region where the current stack resides.
  • HuaweiCloud.StackName: obtains the name of the current stack.

System pseudo parameters can be used together with the mappings and get_in_map functions to obtain predefined configuration information.

For example, an ECS VM can be deployed in the North China, South China, or East China region. You can predefine images and VM specifications for different regions in the mapping table. During stack creation, you can run {get_input: HuaweiCloud.Region} to obtain the region where the current stack resides and obtain configuration information such as images and specifications from the mapping table.

mappings:
  regionMap:
    cn-east-3:   # Defines the East China region.
      flavor: c2.medium    # Indicates the VM specifications of the East China region.
      image_id: f2003c7b-99c4-4616-be19-334beaca81b1   # Indicates the image ID of the East China region.
    cn-north-1: # Defines the North China region.
      flavor: c1.medium    # Indicates the VM specifications of the North China region.
      image_id: 42f34d95-a538-4d17-be48-e690b48c1643   # Indicates the image ID of the North China region. 
    cn-south-1:   # Defines the South China region.
      flavor: c1.medium    # Indicates the VM specifications of the South China region.
      image_id: a3934478-bfeb-4a02-b257-9089779f0380   # Indicates the image ID of the South China region.
node_templates:
  myecs:
    type: HuaweiCloud.ECS.CloudServer
    properties:
      availabilityZone: cn-south-1a
      flavor:
        get_in_map:
          - regionMap
          - get_input: HuaweiCloud.Region
          - flavor
      imageId:
        get_in_map:
          - regionMap
          - get_input: HuaweiCloud.Region
          - image_id
      ...