Verified Commit 66510a0f authored by Hugo's avatar Hugo
Browse files

ingress map ports

parent 8f5d43d4
......@@ -2,6 +2,9 @@ resource "hcloud_load_balancer" "ingress_lb" {
name = "${var.name}-ingress"
load_balancer_type = var.ingress.lbType
location = var.location
algorithm {
type = "least_connections"
}
labels = {
cluster = var.name
}
......@@ -27,9 +30,9 @@ resource "hcloud_load_balancer_target" "ingress_lb_target" {
}
resource "hcloud_load_balancer_service" "ingress_lb_service" {
for_each = toset(var.ingress.ports)
for_each = var.ingress.ports
load_balancer_id = hcloud_load_balancer.ingress_lb.id
protocol = "tcp"
listen_port = each.value
listen_port = each.key
destination_port = each.value
}
......@@ -42,7 +42,7 @@ variable "ingress" {
type = object({
lbType = string
privateIp = string
ports = list(string)
ports = map(string)
})
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment