This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
firewall.tf
97 lines (87 loc) · 1.69 KB
/
firewall.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
resource "hcloud_firewall" "api-fw" {
name = "${var.cluster_name}-fw"
labels = {
"cluster" = var.cluster_name
"role" = "api"
}
apply_to {
label_selector = "cluster=av0"
}
rule {
description = "allow ICMP"
direction = "in"
protocol = "icmp"
source_ips = [
"0.0.0.0/0",
"::/0",
]
}
rule {
description = "allow all TCP inside cluster"
direction = "in"
protocol = "tcp"
port = "any"
source_ips = [
var.ip_range,
]
}
rule {
description = "allow all UDP inside cluster"
direction = "in"
protocol = "udp"
port = "any"
source_ips = [
var.ip_range,
]
}
rule {
description = "allow SSH from any"
direction = "in"
protocol = "tcp"
port = "22"
source_ips = [
"0.0.0.0/0",
"::/0",
]
}
rule {
description = "allow NodePorts from any"
direction = "in"
protocol = "tcp"
port = "30000-32767"
source_ips = [
"0.0.0.0/0",
"::/0"
]
}
rule {
description = "allow kubectl from any"
direction = "in"
protocol = "tcp"
port = "6443"
source_ips = [
"0.0.0.0/0",
"::/0",
]
}
rule {
description = "allow hetzner api and metadata servers tcp"
direction = "in"
protocol = "tcp"
port = "any"
source_ips = [
"169.254.169.254/32",
"213.239.246.1/32",
]
}
rule {
description = "allow hetzner api and metadata servers udp"
direction = "in"
protocol = "udp"
port = "any"
source_ips = [
"169.254.169.254/32",
"213.239.246.1/32",
]
}
}