2023-02-27 12:19:52 -05:00
|
|
|
terraform {
|
|
|
|
required_providers {
|
|
|
|
openstack = {
|
|
|
|
source = "terraform-provider-openstack/openstack"
|
2024-02-12 09:25:23 -05:00
|
|
|
version = "1.54.1"
|
2023-02-27 12:19:52 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "openstack_lb_listener_v2" "listener" {
|
|
|
|
name = var.name
|
|
|
|
protocol = "TCP"
|
|
|
|
protocol_port = var.port
|
|
|
|
loadbalancer_id = var.loadbalancer_id
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "openstack_lb_pool_v2" "pool" {
|
|
|
|
name = var.name
|
|
|
|
protocol = "TCP"
|
|
|
|
lb_method = "ROUND_ROBIN"
|
|
|
|
listener_id = openstack_lb_listener_v2.listener.id
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "openstack_lb_member_v2" "member" {
|
|
|
|
count = length(var.member_ips)
|
|
|
|
name = format("${var.name}-member-%02d", count.index + 1)
|
|
|
|
address = var.member_ips[count.index]
|
|
|
|
protocol_port = var.port
|
|
|
|
pool_id = openstack_lb_pool_v2.pool.id
|
|
|
|
subnet_id = var.subnet_id
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "openstack_lb_monitor_v2" "k8s_api" {
|
|
|
|
name = var.name
|
|
|
|
pool_id = openstack_lb_pool_v2.pool.id
|
|
|
|
type = "TCP"
|
|
|
|
delay = 2
|
|
|
|
timeout = 2
|
|
|
|
max_retries = 2
|
|
|
|
}
|