<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi - I'm trying to create a OS::Neutron::LoadBalancer on the first
    subnet of a network being supplied as a parameter. So I don't want
    to create the network - it's an input parameter - and I don't
    want/need the subnet as a parameter - any subnet defined on the
    network will do.<br>
    <br>
    I cannot figure out how to get the subnet id of the network. In the
    code below I tried to create a port on the network and then extract
    the value of the subnet to use in creating the OS::Neutron::Pool but
    I end up with an extra port. I tried to use the port ip address for
    the VIP but OS::Neutron::Pool wants to create the vip port, and
    complains that the IP address is already in use.<br>
    <br>
    My question is how do we create a resource from a parameter when we
    already have the resource id or name, so the attributes can be
    queried in subsequent resource definitions? Is there a way to do
    that in heat?<br>
    <br>
    <font size="-1">heat_template_version: 2015-10-15<br>
      description: Make a load balancer with a floating ip without a
      subnet<br>
      <br>
      parameters:<br>
        network:<br>
          type: string<br>
          description: Network used by the server<br>
      <br>
        external_network_id:<br>
          type: string<br>
          description: UUID of a Neutron external network<br>
      <br>
      resources:<br>
        make_port_on_the_net:<br>
          type: OS::Neutron::Port<br>
          properties:<br>
            name : {list_join : [":", ["vip"  , {get_param: network}]] }<br>
            network: {get_param: network }<br>
      <br>
        monitor:<br>
          type: OS::Neutron::HealthMonitor<br>
          properties:<br>
            type: TCP<br>
            delay: 5<br>
            max_retries: 5<br>
            timeout: 5<br>
      <br>
        pool:<br>
          type: OS::Neutron::Pool<br>
          properties:<br>
            protocol: HTTP<br>
            monitors: [{get_resource: monitor}]<br>
            subnet: {get_attr: [make_port_on_the_net, fixed_ips, 0,
      subnet_id]}<br>
            lb_method: ROUND_ROBIN<br>
            vip:<br>
              protocol_port: 80<br>
              address: {get_attr: [make_port_on_the_net, fixed_ips, 0,
      ip_address]}<br>
        lb:<br>
          type: OS::Neutron::LoadBalancer<br>
          properties:<br>
            protocol_port: 80<br>
            pool_id: {get_resource: pool}<br>
      <br>
        # assign a floating ip address to the load balancer<br>
        # pool.<br>
        lb_floating:<br>
          type: OS::Neutron::FloatingIP<br>
          properties:<br>
            floating_network_id: {get_param: external_network_id}<br>
            port_id: {get_attr: [pool, vip, port_id]}<br>
      <br>
      outputs:<br>
        port_show:<br>
          value: {get_attr: [make_port_on_the_net]}<br>
          description: Dump all the port attributes</font><br>
    <br>
  </body>
</html>