heat_template_version: newton


description: |
  Creates a floating IP connected to an existing Neutron port


parameters:

  network:
    type: string
    description: |
      provisioner network where floating IP addresses will be allocated
    constraints:
    - custom_constraint: neutron.network

  port:
    type: string
    description: |
      port where fixed IP is being allocated
    constraints:
    - custom_constraint: neutron.port


resources:

  _network:
    type: OS::Neutron::Net
    external_id: {get_param: network}

  _port:
    type: OS::Neutron::Port
    external_id: {get_param: port}

  _floating_ip:
    type: OS::Neutron::FloatingIP
    description: Floating IP address to be connected to server
    properties:
      floating_network: {get_resource: _network}
      port_id: {get_resource: _port}


outputs:

  fixed_ips:
    description: fixed IP addresses of server
    value: {get_attr: [_port, fixed_ips]}

  floating_ip_address:
    description: floating IP address of server in public network
    value: { get_attr: [_floating_ip, floating_ip_address] }

  netowkr_id:
    value: {get_resource: _network}

  port_id:
    value: {get_resource: _port}

  floating_ip_id:
    description: floating IP identifier
    value: { get_resource: _floating_ip }
