Referring to information

Usually systems are configured with many resources being coordinated with other resources.

For example, virtual servers need system volumes, and virtual servers are connected to the network.

In Heat templates it is possible to directly describe the resource information (ID, etc.) of dependencies, however, when creating resources simultaneously as in "Sample system configuration - Example Heat template", it is not possible to describe that information.

In this type of situation, using functions enables defined resource information and parameters to be reflected on the "resources" of created resources.

* For details on functions, refer to "Intrinsic Functions".

The following is an example of how to refer to information, using the get_resource function to set the connection of the virtual server to the network, when creating the virtual server and the network at the same time.

resources:
  network:
    type: OS::Neutron::Net

  subnet:
    type: OS::Neutron::Subnet
    properties:
      network_id: { get_resource: network }

  port:
    type: OS::Neutron::Port
    properties:
      network_id: { get_resource: network }
      fixed_ips:
        - subnet_id: { get_resource: subnet }

  server:
    type: OS::Nova::Server
    properties:
      networks: ["port": {get_resource: port} ]