-
Notifications
You must be signed in to change notification settings - Fork 0
/
nlb_kafka.tf
67 lines (55 loc) · 1.57 KB
/
nlb_kafka.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
57
58
59
60
61
62
63
64
65
66
67
resource "aws_lb" "kafka" {
name = format("%s-kafka", var.cluster_name)
internal = var.kafka_nlb_ingress_internal
load_balancer_type = var.kafka_nlb_ingress_type
subnets = [
aws_subnet.public_subnet_1a.id,
aws_subnet.public_subnet_1b.id,
aws_subnet.public_subnet_1c.id
]
enable_deletion_protection = var.kafka_nlb_ingress_enable_termination_protection
enable_cross_zone_load_balancing = var.kafka_enable_cross_zone_load_balancing
tags = {
"kubernetes.io/cluster/${var.cluster_name}" = "shared"
}
depends_on = [
helm_release.strimzi,
helm_release.alb_ingress_controller
]
}
resource "aws_lb_target_group" "plaintext" {
name = format("%s-plaintext", var.cluster_name)
port = 9092
protocol = "TCP"
vpc_id = aws_vpc.cluster_vpc.id
}
resource "aws_lb_listener" "plaintext" {
load_balancer_arn = aws_lb.kafka.arn
port = "9092"
protocol = "TCP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.plaintext.arn
}
}
resource "kubectl_manifest" "kafka_plaintext" {
yaml_body = <<YAML
apiVersion: elbv2.k8s.aws/v1beta1
kind: TargetGroupBinding
metadata:
name: cluster-kafka-plain-bootstrap
namespace: strimzi
spec:
serviceRef:
name: cluster-kafka-plain-bootstrap
port: 9092
targetGroupARN: ${aws_lb_target_group.plaintext.arn}
YAML
depends_on = [
aws_eks_cluster.main,
aws_eks_node_group.observability,
helm_release.alb_ingress_controller,
helm_release.prometheus,
time_sleep.wait_operator
]
}