heat_template_version: 2013-05-23

description: sample

parameters:
  floating_id:
    type: string
    description: ID reseau public
    default: 28d2e22e-620e-465f-b1cc-12f7aa38581a

  internal_cidr:
    type: string
    description: CIDR for the internal net
    default: "10.5.5.0/24"

  image:
    type: string
    description: Glance image to use
    default: "cirros"


resources:
  internal_net:
    type: OS::Neutron::Net

  internal_snet:
    type: OS::Neutron::Subnet
    properties:
      cidr: { get_param: internal_cidr }
      network_id: { get_resource: internal_net }

  router:
    type: OS::Neutron::Router
    properties:
      external_gateway_info:
        enable_snat: true
        network: { get_param: floating_id }

  router_interface:
    type: OS::Neutron::RouterInterface
    properties:
      router_id: { get_resource: router }
      subnet_id: { get_resource: internal_snet }


  port_vm0:
    type: OS::Neutron::Port
    properties:
      network: { get_resource: internal_net }
      security_groups:
        - default

  floating_ip_vm0:
    type: OS::Neutron::FloatingIP
    properties:
      floating_network_id: { get_param: floating_id }
      port_id: { get_resource: port_vm0 }

  vm0:
    type: OS::Nova::Server
    depends_on: [router_interface]
    properties:
      image: { get_param: image }
      flavor: m1.small
      networks:
        - port: { get_resource: port_vm0 }


  port_vm1:
    type: OS::Neutron::Port
    properties:
      network: { get_resource: internal_net }
      security_groups:
        - default

  floating_ip_vm1:
    type: OS::Neutron::FloatingIP
    properties:
      floating_network_id: { get_param: floating_id }
      port_id: { get_resource: port_vm1 }

  vm1:
    type: OS::Nova::Server
    depends_on: [router_interface]
    properties:
      image: { get_param: image }
      flavor: m1.nano
      networks:
        - port: { get_resource: port_vm1 }
