1
0
Fork 0
This repository has been archived on 2025-08-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
mareshq-cthulhunetes-infras.../loadbalancers.tf

59 lines
1.6 KiB
HCL

resource "hcloud_load_balancer" "ingress" {
name = "ingress"
load_balancer_type = "lb11"
location = "fsn1"
labels = {
"env" = "production"
"k8s.cluster.name" = "cthulhu"
"k8s.loadbalancer.target" = "ingress"
}
}
resource "hcloud_load_balancer_target" "ingress" {
type = "label_selector"
label_selector = "k8s.node.role=worker"
use_private_ip = true
load_balancer_id = hcloud_load_balancer.ingress.id
depends_on = [hcloud_load_balancer_network.ingress_to_network]
}
resource "hcloud_load_balancer_service" "ingress_workers_tcp_80" {
load_balancer_id = hcloud_load_balancer.ingress.id
protocol = "tcp"
listen_port = 80
destination_port = 32080
proxyprotocol = true
}
resource "hcloud_load_balancer_service" "ingress_workers_tcp_443" {
load_balancer_id = hcloud_load_balancer.ingress.id
protocol = "tcp"
listen_port = 443
destination_port = 32443
proxyprotocol = true
}
resource "cloudflare_record" "ingress_cthulhu_k8s_vxm_cz" {
zone_id = local.vxm_cz_zone_id
name = "ingress.cthulhu.k8s"
value = hcloud_load_balancer.ingress.ipv4
type = "A"
proxied = false
}
resource "cloudflare_record" "ingress_cthulhu_k8s_vxm_cz_ipv6" {
zone_id = local.vxm_cz_zone_id
name = "ingress.cthulhu.k8s"
value = hcloud_load_balancer.ingress.ipv6
type = "AAAA"
proxied = false
}
resource "hcloud_load_balancer_network" "ingress_to_network" {
load_balancer_id = hcloud_load_balancer.ingress.id
network_id = hcloud_network.cthulhu.id
ip = cidrhost(hcloud_network_subnet.service.ip_range, 1)
}