-
Notifications
You must be signed in to change notification settings - Fork 0
/
ingress.tf
36 lines (36 loc) · 803 Bytes
/
ingress.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
resource "kubernetes_ingress_v1" "ingress" {
count = length(var.ingress) > 0 ? 1 : 0
metadata {
name = var.name
namespace = var.namespace
annotations = local.ingress_annotations
}
spec {
tls {
hosts = keys(var.ingress)
secret_name = "${var.name}-tls-secret"
}
dynamic "rule" {
for_each = var.ingress
content {
host = rule.key
http {
dynamic "path" {
for_each = rule.value
content {
path = path.key
backend {
service {
name = "${var.name}-${path.value}"
port {
number = 80
}
}
}
}
}
}
}
}
}
}