40 lines
852 B
HCL
40 lines
852 B
HCL
resource "hcloud_server" "lb" {
|
|
name = "LB"
|
|
image = "ubuntu-22.04"
|
|
server_type = "cx21"
|
|
location = var.location
|
|
labels = {
|
|
app = "lb"
|
|
}
|
|
ssh_keys = var.ssh_key_ids
|
|
|
|
public_net {
|
|
ipv4_enabled = true
|
|
ipv6_enabled = false
|
|
}
|
|
|
|
network {
|
|
network_id = var.network_id
|
|
ip = var.lb_internal_ip
|
|
}
|
|
}
|
|
|
|
resource "hcloud_load_balancer_target" "main" {
|
|
type = "server"
|
|
load_balancer_id = var.lb_service_id
|
|
use_private_ip = true
|
|
server_id = hcloud_server.lb.id
|
|
}
|
|
|
|
resource "hcloud_load_balancer_network" "main" {
|
|
load_balancer_id = var.lb_service_id
|
|
network_id = var.network_id
|
|
}
|
|
|
|
resource "hcloud_load_balancer_service" "load_balancer_service" {
|
|
load_balancer_id = var.lb_service_id
|
|
protocol = "tcp"
|
|
listen_port = 443
|
|
destination_port = 443
|
|
}
|