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

get_in_map

If a mapping table is defined in the template, you can use the get_in_map function to obtain the mapping table content from the node_templates and outputs sections.

Syntax

get_in_map: [map_name, top_level_key, second_level_key]

Parameter Description

Table 1 Parameter description

Parameter

Mandatory

Description

map_name

Yes

Mapping name

top_level_key

Yes

Mapping object name

second_level_key

Yes

Mapping object property

Return Value

Value of the corresponding field in the mapping table.

Examples

Obtaining the mapped content using the get_in_map function:

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
      ...