1
0
Fork 0
terraform-playground/three-web-hosts/loadbalancer.tf

26 lines
944 B
HCL

resource "hcloud_load_balancer" "three_web_load_balancer" {
name = "three-web-load-balancer"
load_balancer_type = "lb11"
location = var.location
}
resource "hcloud_load_balancer_network" "three_web_load_balancer_network" {
load_balancer_id = hcloud_load_balancer.three_web_load_balancer.id
subnet_id = hcloud_network_subnet.three_web_private_subnet.id
}
resource "hcloud_load_balancer_target" "three_web_load_balancer_target" {
type = "label_selector"
load_balancer_id = hcloud_load_balancer.three_web_load_balancer.id
label_selector = "type=web"
use_private_ip = true
depends_on = [hcloud_load_balancer_network.three_web_load_balancer_network]
}
resource "hcloud_load_balancer_service" "load_balancer_service" {
load_balancer_id = hcloud_load_balancer.three_web_load_balancer.id
protocol = "http"
listen_port = 80
destination_port = 80
}