-
Notifications
You must be signed in to change notification settings - Fork 19
/
lb.tf
36 lines (30 loc) · 996 Bytes
/
lb.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
// https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.29.0/deploy/static/provider/aws/service-nlb.yaml
resource "kubernetes_service" "lb" {
metadata {
name = var.name
namespace = kubernetes_namespace.nginx.metadata.0.name
labels = {
"app.kubernetes.io/name" = var.name
"app.kubernetes.io/part-of" = kubernetes_namespace.nginx.metadata.0.name
"app.kubernetes.io/managed-by" = "terraform"
}
annotations = var.lb_annotations
}
spec {
type = "LoadBalancer"
selector = {
"app.kubernetes.io/name" = var.name
"app.kubernetes.io/part-of" = kubernetes_namespace.nginx.metadata.0.name
}
external_traffic_policy = "Local"
dynamic "port" {
for_each = var.lb_ports
content {
name = port.value.name
port = port.value.port
target_port = port.value.target_port
}
}
load_balancer_source_ranges = var.load_balancer_source_ranges
}
}