Updated on 2022-02-22 GMT+08:00

get_input

The get_input function is used to obtain the value of the input parameter defined in the inputs section of the template file. In addition, it can be used to 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: cloud_tosca_version_1_0
inputs:
  name:
    default: test-vpc
  cidr:
    default: 10.0.0.0/8  
node_templates:
  my-first-vpc:
    type: Cloud.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:
  • Cloud.UserId: obtaining the user ID of the current stack creator.
  • Cloud.ProjectId: obtaining the ID of the project to which the current stack belongs.
  • Cloud.DomainId: obtaining the ID of the account to which the current stack belongs.
  • Cloud.Region: obtaining the ID of the region where the current stack resides.
  • Cloud.StackName: obtaining 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 different regions. You can predefine images and VM specifications for different regions in the mapping table. During stack creation, you can run {get_input: Cloud.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:
    ae-ad-1:   
      flavor: c2.medium    
      image_id: f2003c7b-99c4-4616-be19-334beaca81b1   
node_templates:
  myecs:
    type: Cloud.ECS.CloudServer
    properties:
      availabilityZone: ae-ad-1a
      flavor:
        get_in_map:
          - regionMap
          - get_input: Cloud.Region
          - flavor
      imageId:
        get_in_map:
          - regionMap
          - get_input: Cloud.Region
          - image_id
      ...