FEATURES PRICING ABOUT DOCS LOGIN

openstack_lb_pool_v1

Manages a V1 load balancer pool resource within OpenStack.

Example Usage

resource "openstack_lb_pool_v1" "pool_1" {
  name = "tf_test_lb_pool"
  protocol = "HTTP"
  subnet_id = "12345"
  lb_method = "ROUND_ROBIN"
  lb_provider = "haproxy"
  monitor_ids = ["67890"]
}

Complete Load Balancing Stack Example

resource "openstack_networking_network_v2" "network_1" {
  name = "network_1"
  admin_state_up = "true"
}

resource "openstack_networking_subnet_v2" "subnet_1" {
  network_id = "${openstack_networking_network_v2.network_1.id}"
  cidr = "192.168.199.0/24"
  ip_version = 4
}

resource "openstack_compute_secgroup_v2" "secgroup_1" {
  name = "secgroup_1"
  description = "Rules for secgroup_1"

  rule {
    from_port = -1
    to_port = -1
    ip_protocol = "icmp"
    cidr = "0.0.0.0/0"
  }

  rule {
    from_port = 80
    to_port = 80
    ip_protocol = "tcp"
    cidr = "0.0.0.0/0"
  }
}

resource "openstack_compute_instance_v2" "instance_1" {
  name = "instance_1"
  security_groups = ["default", "${openstack_compute_secgroup_v2.secgroup_1.name}"]
  network {
    uuid = "${openstack_networking_network_v2.network_1.id}"
  }
}

resource "openstack_compute_instance_v2" "instance_2" {
  name = "instance_2"
  security_groups = ["default", "${openstack_compute_secgroup_v2.secgroup_1.name}"]
  network {
    uuid = "${openstack_networking_network_v2.network_1.id}"
  }
}

resource "openstack_lb_monitor_v1" "monitor_1" {
  type = "TCP"
  delay = 30
  timeout = 5
  max_retries = 3
  admin_state_up = "true"
}

resource "openstack_lb_pool_v1" "pool_1" {
  name = "pool_1"
  protocol = "TCP"
  subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
  lb_method = "ROUND_ROBIN"
  monitor_ids = ["${openstack_lb_monitor_v1.monitor_1.id}"]
}

resource "openstack_lb_member_v1" "member_1" {
  pool_id = "${openstack_lb_pool_v1.pool_1.id}"
  address = "${openstack_compute_instance_v2.instance_1.access_ip_v4}"
  port = 80
}

resource "openstack_lb_member_v1" "member_2" {
  pool_id = "${openstack_lb_pool_v1.pool_1.id}"
  address = "${openstack_compute_instance_v2.instance_2.access_ip_v4}"
  port = 80
}

resource "openstack_lb_vip_v1" "vip_1" {
  name = "vip_1"
  subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
  protocol = "TCP"
  port = 80
  pool_id = "${openstack_lb_pool_v1.pool_1.id}"
}

Argument Reference

The following arguments are supported:

The member block supports:

Attributes Reference

The following attributes are exported:

Notes

The member block is deprecated in favor of the openstack_lb_member_v1 resource.

Import

Load Balancer Pools can be imported using the id, e.g.

$ terraform import openstack_lb_pool_v1.pool_1 b255e6ba-02ad-43e6-8951-3428ca26b713

See the source of this document at Terraform.io

REQUEST A DEMO