Ask Your Question
1

Get outputs from nested stack

asked 2014-12-24 04:14:59 -0500

erivni gravatar image

Hi,

Is there a way in Heat to extract nested template outputs?

Here's a simple example for nested stacks.

I found this document Template composition on Openstack docs.

But, is there a way to get nested template outputs even if they are not attributes for nested resources?

Thanks!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-12-29 05:06:47 -0500

cmyster gravatar image

Yes there is, the nested stack should have an output of the attribute that you are interested in and the parent template can simply call for that attribute. For instance, this 'parent' has two nested templates, Network and LoadBalancer (both are Neutron resources). The parent will define both like so (Note those are not complete pastes):

resources:
  network:
    type: network.yaml

  load_balancer:
    type: lb.yaml
    properties:
      private_subnet: {get_attr: [network, private_subnet_id]}
      depends_on: network

Now, the network template creates a private network and has this as an output:

resources:
  private_network:
    type: OS::Neutron::Net
    properties:
      name: private_net_heat

outputs:
  private_network_id:
    value: {get_resource: private_network}

As you can see, by creating an attribute called private_network_id and giving it the value of the private network, the Load Balancer template can use it as a parameter for the pool resource:

parameters:
  private_subnet:
    type: string

resources:
pool:
    type: OS::Neutron::Pool
    properties:
      protocol: HTTP
      monitors: [{get_resource: monitor}]
      subnet_id: {get_param: private_subnet}
      lb_method: ROUND_ROBIN
      vip:
        protocol_port: 80
edit flag offensive delete link more

Comments

Thanks! It's exactly what I need!

erivni gravatar imageerivni ( 2014-12-30 01:15:10 -0500 )edit

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: 2014-12-24 04:14:59 -0500

Seen: 2,028 times

Last updated: Dec 29 '14