Introduces the Terraform config for the Hetzner cloud firewall #24
62
firewall.tf
Normal file
62
firewall.tf
Normal file
|
@ -0,0 +1,62 @@
|
|||
resource "hcloud_firewall" "forgejo-fw" {
|
||||
name = "forgejo-fw"
|
||||
rule {
|
||||
direction = "in"
|
||||
protocol = "icmp"
|
||||
source_ips = [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
]
|
||||
description = "icmp"
|
||||
}
|
||||
rule {
|
||||
direction = "in"
|
||||
protocol = "tcp"
|
||||
port = "22"
|
||||
source_ips = [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
]
|
||||
description = "ssh forgejo"
|
||||
}
|
||||
rule {
|
||||
direction = "in"
|
||||
protocol = "tcp"
|
||||
port = "50001"
|
||||
source_ips = [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
]
|
||||
description = "ssh os"
|
||||
}
|
||||
rule {
|
||||
direction = "in"
|
||||
protocol = "tcp"
|
||||
port = "80"
|
||||
source_ips = [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
]
|
||||
description = "http"
|
||||
}
|
||||
rule {
|
||||
direction = "in"
|
||||
protocol = "tcp"
|
||||
port = "443"
|
||||
source_ips = [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
]
|
||||
description = "https"
|
||||
}
|
||||
rule {
|
||||
direction = "in"
|
||||
protocol = "tcp"
|
||||
port = "9100"
|
||||
source_ips = [
|
||||
"0.0.0.0/0",
|
||||
"::/0"
|
||||
]
|
||||
description = "node_exporter"
|
||||
}
|
||||
}
|
1
main.tf
1
main.tf
|
@ -15,6 +15,7 @@ resource "hcloud_server" "production" {
|
|||
})
|
||||
delete_protection = true
|
||||
rebuild_protection = true
|
||||
firewall_ids = [hcloud_firewall.forgejo-fw.id]
|
||||
}
|
||||
|
||||
# Set RDNS entry of production server IPv4
|
||||
|
|
|
@ -35,6 +35,7 @@ resource "hcloud_server" "staging" {
|
|||
ipv4 = hcloud_primary_ip.staging-ipv4.id
|
||||
ipv6 = hcloud_primary_ip.staging-ipv6.id
|
||||
}
|
||||
firewall_ids = [hcloud_firewall.forgejo-fw.id]
|
||||
}
|
||||
|
||||
# Set RDNS entry of staging server IPv4
|
||||
|
|
Loading…
Reference in a new issue