Creating Maps

Not Oracle Cloud at Customer This topic does not apply to Oracle Cloud at Customer.

Use maps in your Oracle Cloud Stack template to define static values, and then refer to these values in other template components such as resources.

A map contains one or more submaps. A submap contains one or more key-value pairs.

For an introduction, see What are Maps.

Defining a Map

Define a map in your Oracle Cloud Stack template.

  1. Access the Oracle Cloud Stack console, and then edit your template.
  2. To the right of Mappings, click Add map Plus icon.
  3. Enter a name for the map.
  4. Enter a name for the first submap.
  5. To the right of the first submap, click Add submap key/value pair Plus icon.
  6. Enter a Key and a Value.
  7. Repeat from step 5 for each additional key/value pair that you want to create in the submap.
  8. Repeat from step 4 for each additional submap that you want to create in this map.
    If you need to create more than 4 submaps in this map, click Add more submap rows Plus icon.
  9. Click Apply Changes.
  10. Click Save the current template Save icon.

Using a Map in a Resource Parameter

Use values defined in a map to configure resources in an Oracle Cloud Stack template.

  1. Access the Oracle Cloud Stack console, and then edit your template.
  2. On the canvas, right-click the resource you want to modify, and then select Edit.
  3. Click the value of the parameter to edit it.
  4. Use the FindInMap function. Enter the map name, submap name, and key name as a YAML sequence.

    Format:

    'Fn::FindInMap':
      - mapName
      - submapName
      - keyName

    For example:

    'Fn::FindInMap':
      - shapes
      - dev
      - DB

    Any of the function parameters can be determined programmatically. For example:

    'Fn::FindInMap':
      - shapes
      - 'Fn::GetParam': appState
      - DB
  5. Click Apply Changes.
  6. Click Save the current template Save icon.

Tip:

A YAML sequence can also be expressed with the following syntax:
'Fn::FindInMap': [mapName,submapName,keyName]