-
Notifications
You must be signed in to change notification settings - Fork 2
/
security-groups.tf
62 lines (52 loc) · 1.5 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
resource "yandex_vpc_security_group" "securtiy_group_master" {
count = var.security_group_create ? 1 : 0
name = "${var.network_name}-manager"
description = "${var.network_name}'s security group for master"
network_id = local.network_id
folder_id = var.folder_id
ingress {
protocol = "ICMP"
description = "icmp"
v4_cidr_blocks = ["0.0.0.0/0"]
}
ingress {
protocol = "TCP"
description = "ssh"
v4_cidr_blocks = ["0.0.0.0/0"]
port = 22
}
egress {
protocol = "ANY"
description = "Allow any"
v4_cidr_blocks = ["0.0.0.0/0"]
}
}
resource "yandex_vpc_security_group" "security_group_worker" {
count = var.security_group_create ? 1 : 0
name = "${var.network_name}-worker"
description = "${var.network_name}'s security group for docker-machine master"
network_id = local.network_id
folder_id = var.folder_id
ingress {
protocol = "ICMP"
description = "icmp"
v4_cidr_blocks = ["0.0.0.0/0"]
}
ingress {
protocol = "TCP"
description = "ssh"
security_group_id = yandex_vpc_security_group.securtiy_group_master[0].id
port = 22
}
ingress {
protocol = "TCP"
description = "docker"
security_group_id = yandex_vpc_security_group.securtiy_group_master[0].id
port = 2376
}
egress {
protocol = "ANY"
description = "Allow any"
v4_cidr_blocks = ["0.0.0.0/0"]
}
}