-
Notifications
You must be signed in to change notification settings - Fork 0
/
loadbalancer-ingress.tf
56 lines (47 loc) · 1.22 KB
/
loadbalancer-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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
resource "aws_lb" "k8s_ingress" {
name = "${var.name}-ingress"
internal = false
load_balancer_type = "network"
subnets = aws_subnet.public[*].id
enable_cross_zone_load_balancing = true
}
resource "aws_lb_listener" "http" {
load_balancer_arn = aws_lb.k8s_ingress.arn
port = "80"
protocol = "TCP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.k8s_ingress_http.arn
}
}
resource "aws_lb_listener" "https" {
load_balancer_arn = aws_lb.k8s_ingress.arn
port = "443"
protocol = "TCP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.k8s_ingress_https.arn
}
}
resource "aws_lb_target_group" "k8s_ingress_http" {
name = "${var.name}-ingress-http"
port = 30080
protocol = "TCP"
vpc_id = aws_vpc.main.id
health_check {
protocol = "TCP"
port = 30080
interval = 30
}
}
resource "aws_lb_target_group" "k8s_ingress_https" {
name = "${var.name}-ingress-https"
port = 30443
protocol = "TCP"
vpc_id = aws_vpc.main.id
health_check {
protocol = "TCP"
port = 30443
interval = 30
}
}