Ask Your Question
0

Is it possible to create multiple openstack resources using same heat resource

asked 2020-04-27 18:30:31 -0500

GSCORREA gravatar image

What I am trying to achieve is a way to create several entities (in this case networks) using same resource and iterating through a list of parameters, like the example below.

    parameters:
      netName:
        type: comma_delimited_list
        label: netName
        default: "calea,diam,ss7,proxy"
        description: Network name
    resources:
      repeat:
        template:
          networks:
            type: OS::Neutron::Net
              properties:
                name:
                  list_join: ['_', [ 'int', <%name%>, 'net']]
        for_each:
          <%name%>: { get_param: netName }
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2020-04-30 11:47:22 -0500

zaneb gravatar image

There's no way to use the repeat function outside of a resource, as you've no doubt discovered. The best alternative is really to generate the template using some external system (e.g. jinja templating).

However, another option is to use a ResourceGroup. You can't just create a group of OS::Neutron::Port resources though, you have to define another template that contains a port resource and has parameters for the index and the list of netNames, and then select the appropriate name from the list inside the template.

edit flag offensive delete link more
0

answered 2020-04-28 06:29:12 -0500

updated 2020-04-28 06:32:04 -0500

Hello you can create by this

**


resources:  
        piyush_net_1_port:
             type: OS::Neutron::Port
             properties:
             network: { get_param: id0 }
             name: piyush_net_1_port

        piyush_net_2_port:
             type: OS::Neutron::Port
             properties:
             network: { get_param: id1 }
             name: piyush_net_2_port

** for multiple port same keep extending value

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2020-04-27 18:30:31 -0500

Seen: 89 times

Last updated: Apr 30