stackit: add k8s api load balancer (#2925)

This commit is contained in:
3u13r 2024-02-22 17:39:34 +01:00 committed by GitHub
parent 62acec17f6
commit 2a61861a1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 298 additions and 378 deletions

View file

@ -0,0 +1,47 @@
terraform {
required_providers {
stackit = {
source = "stackitcloud/stackit"
version = "0.12.0"
}
}
}
resource "stackit_loadbalancer" "loadbalancer" {
project_id = var.stackit_project_id
name = "${var.name}-lb"
target_pools = [
for portName, port in var.ports : {
name = "target-pool-${portName}"
target_port = port
targets = [
for ip in var.member_ips : {
display_name = "target-${portName}"
ip = ip
}
]
active_health_check = {
healthy_threshold = 10
interval = "3s"
interval_jitter = "3s"
timeout = "3s"
unhealthy_threshold = 10
}
}
]
listeners = [
for portName, port in var.ports : {
name = "listener-${portName}"
port = port
protocol = "PROTOCOL_TCP"
target_pool = "target-pool-${portName}"
}
]
networks = [
{
network_id = var.network_id
role = "ROLE_LISTENERS_AND_TARGETS"
}
]
external_address = var.external_address
}