[Openstack] HOT ResourceGroup index referencing with get_attr

Lars-Erik Helander lars-erik.helander at proceranetworks.com
Sun Mar 12 18:09:36 UTC 2017


Here are two templates foo.yaml and bar.yaml


foo.yaml

heat_template_version: newton

description: >
  Create a set of channel ports on a specific network. 


parameters:

  network:
    type: string
    description: Network
    label: Network

  port_count:
    type: number
    description: Number of channel ports to create
    label: Port count
    default: 1

  channel_ports:
    type: comma_delimited_list
    description: List of channel ports
    label: Channel ports

resources:


  ports:
    type: OS::Heat::ResourceGroup
    properties:
      count: { get_param: port_count }
      resource_def: 
        type: bar.yaml
        properties:
          network: { get_param: network}
          ports: { get_param: channel_ports }
          index: "%index%"



bar.yaml

heat_template_version: newton

description: >
  A port created based on a list of names


parameters:


  ports:
    type: comma_delimited_list
    description: List of channel ports
    label: Channel ports

  index:
    type: number
    description: Index into channel ports list
    label: index

  network:
    type: string
    description: Network to allocate port from
    label: Network

 
resources:


  port:
    type: OS::Neutron::Port
    properties:
      network_id: { get_param: network}
      name: { get_param: [ports, { get_param: index } ] } 
      port_security_enabled: False 







On 2017-03-12, 17:59, "Turbo Fredriksson" <turbo at bayour.com> wrote:

    On 12 Mar 2017, at 15:59, Lars-Erik Helander <lars-erik.helander at proceranetworks.com> wrote:
    
    > I think you need to pass %index% in a string, e.g.
    
    Could you give me some examples? I’m really struggling to get this working!
    
    
    _______________________________________________
    Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
    Post to     : openstack at lists.openstack.org
    Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
    



More information about the Openstack mailing list