1
0
Fork 0

chore: move .tf files from terraform/ to root dir

This commit is contained in:
Vojtěch Mareš 2024-01-23 15:41:39 +01:00
parent 3a2ac8bc50
commit 99a24440c7
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D
8 changed files with 0 additions and 0 deletions

59
loadbalancers.tf Normal file
View file

@ -0,0 +1,59 @@
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)
}