-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfirewall.tf
More file actions
47 lines (40 loc) · 894 Bytes
/
firewall.tf
File metadata and controls
47 lines (40 loc) · 894 Bytes
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
# Hetzner Cloud-level firewall
# Only expose SSH, HTTP, and HTTPS - Caddy handles reverse proxying
resource "hcloud_firewall" "engram" {
name = "engram-firewall"
# SSH
rule {
direction = "in"
protocol = "tcp"
port = "22"
source_ips = ["0.0.0.0/0", "::/0"]
}
# HTTP (Caddy)
rule {
direction = "in"
protocol = "tcp"
port = "80"
source_ips = ["0.0.0.0/0", "::/0"]
}
# HTTPS (Caddy)
rule {
direction = "in"
protocol = "tcp"
port = "443"
source_ips = ["0.0.0.0/0", "::/0"]
}
# ICMP (ping)
rule {
direction = "in"
protocol = "icmp"
source_ips = ["0.0.0.0/0", "::/0"]
}
labels = {
project = "engram"
managed-by = "opentofu"
}
}
resource "hcloud_firewall_attachment" "engram" {
firewall_id = hcloud_firewall.engram.id
server_ids = [hcloud_server.engram.id]
}