HEAT template to attach an unknown number of ports (opened on different networks) to a server
I am trying to open as many number of ports(OS::Neutron::Port) on the provider networks mentioned by the user(via the parameter file) and trying to attach them to the server(OS::Nova::Server) that is being created. How to achieve the above requirement?
heat_template_version: 2016-04-08
parameters:
nwNames:
type: comma_delimited_list
description: The list of provider network names whose size is 'N'. N={X, Y,......N}
resources:
portX:
type: OS::Neutron::Port
properties:
network: { get_param: NetworkX }
security_groups:
- { get_param: securityGroup }
portY:
type: OS::Neutron::Port
properties:
network: { get_param: NetworkY }
security_groups:
- { get_param: securityGroup }
portN:
type: OS::Neutron::Port
properties:
network: { get_param: NetworkN }
security_groups:
- { get_param: securityGroup }
server1:
type: OS::Nova::Server
depends_on: [ portX, portY,....PortN ]
properties:
image: { get_param: image }
flavor: { get_param: flavor }
name: { get_param: [ vmNames, get_param: index ] }
networks:
- port: { get_resource: portA }
- port: { get_resource: portB }
- port: { get_resource: portN }
outputs:
My attempt: I gave a try using the OS::Heat::ResourceGroup by creating all the required network ports within a single ResourceGroup, but I wasn't able to iterate through them in order to attach it to the server.
Thanks in Advance.