-
Notifications
You must be signed in to change notification settings - Fork 0
/
security_groups.tf
executable file
·79 lines (66 loc) · 1.65 KB
/
security_groups.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
68
69
70
71
72
73
74
75
76
77
78
79
resource "aws_security_group" "remote_ssh" {
count = var.create_kafka_cluster ? 1 : 0
name = "remote_ssh_security_group"
description = "Allow ssh traffic"
vpc_id = "${var.vpc_id}"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = "${var.whitelist_cidrs}"
}
}
resource "aws_security_group" "kafka_broker" {
count = var.create_kafka_cluster ? 1 : 0
name = "kafka_broker_security_group"
description = "Allow kafka traffic"
vpc_id = "${var.vpc_id}"
ingress {
from_port = 9092
to_port = 9092
protocol = "tcp"
cidr_blocks = "${concat([data.aws_vpc.current.cidr_block], var.whitelist_cidrs)}"
}
ingress {
from_port = 19092
to_port = 19092
protocol = "tcp"
self = true
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_security_group" "zookeeper_node" {
count = var.create_kafka_cluster ? 1 : 0
name = "zookeeper_node_security_group"
description = "Allow zookeeper traffic"
vpc_id = "${var.vpc_id}"
ingress {
from_port = 2181
to_port = 2181
protocol = "tcp"
cidr_blocks = "${concat([data.aws_vpc.current.cidr_block], var.whitelist_cidrs)}"
}
ingress {
from_port = 2888
to_port = 2888
protocol = "tcp"
self = true
}
ingress {
from_port = 3888
to_port = 3888
protocol = "tcp"
self = true
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}