Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I managed to solve this issue today and I want to post it for anyone who is looking to do the same or similar.

NOTE: There are some modifications from my original question.I'm now using subnet UUIDs, and not network, or subnet names.

This example template will take a comma separated input parameter of any subnet UUIDs I want to attach an interface to, and loop through them to create a port attached to the VM instance. In this example I am attaching 5 network ports to my Cirros image, each with port security disabled (no security group).

'internal_nets' input parameter (test input data)

a6c4eb4c-ecaa-4b03-bcb3-7012ec35c5b0,98b3aad4-9a4d-489e-94a6-90a0bdd6e75a,708bfeae-187e-4a85-9a1b-19b3b00c0036,839cb1e1-f429-4bf6-966a-ecefee0819a4,57fa3933-67e3-41ad-8197-eb987a37bb5f

Heat Template

heat_template_version: 2017-02-24
parameters:

    internal_nets:
      type: comma_delimited_list
      label: Subnet UUIDs
      description: Comma Separated List of Subnet UUIDs

    resources:

      TestVM:
        type: OS::Nova::Server
        properties:
          flavor: m1.tiny
          image: cirros
          config_drive: true
          networks:
            repeat:
              for_each:
                <%subnet%>: { get_param: internal_nets }
              template:
                subnet: <%subnet%>
                port_extra_properties:
                  port_security_enabled: false