27 lines
693 B
HCL

resource "hcloud_load_balancer" "main" {
name = "main"
load_balancer_type = var.lb_type
location = var.location
algorithm {
type = var.lb_algorithm
}
}
resource "hcloud_load_balancer_network" "main" {
load_balancer_id = hcloud_load_balancer.main.id
subnet_id = var.subnet_id
ip = var.lb_internal_ip
}
resource "hcloud_load_balancer_target" "main" {
type = "label_selector"
load_balancer_id = hcloud_load_balancer.main.id
label_selector = "app=web"
use_private_ip = true
}
resource "hcloud_load_balancer_service" "main" {
load_balancer_id = hcloud_load_balancer.main.id
protocol = "http"
}