mirror of
https://github.com/NetworkCats/rustyip.git
synced 2026-11-27 08:06:17 +00:00
39 lines
1.3 KiB
Terraform
39 lines
1.3 KiB
Terraform
resource "vultr_firewall_group" "rustyip" {
|
|
description = "${var.instance_label} firewall"
|
|
}
|
|
|
|
# Allow SSH from anywhere (IPv4)
|
|
resource "vultr_firewall_rule" "ssh_v4" {
|
|
firewall_group_id = vultr_firewall_group.rustyip.id
|
|
protocol = "tcp"
|
|
ip_type = "v4"
|
|
subnet = "0.0.0.0"
|
|
subnet_size = 0
|
|
port = "22"
|
|
notes = "Allow SSH from anywhere"
|
|
}
|
|
|
|
# Allow HTTPS from anywhere (IPv4). The host restricts it to Cloudflare's
|
|
# ranges with UFW (ansible firewall role), which keeps the list current.
|
|
resource "vultr_firewall_rule" "https_v4" {
|
|
firewall_group_id = vultr_firewall_group.rustyip.id
|
|
protocol = "tcp"
|
|
ip_type = "v4"
|
|
subnet = "0.0.0.0"
|
|
subnet_size = 0
|
|
port = "443"
|
|
notes = "Allow HTTPS; host UFW limits it to Cloudflare"
|
|
}
|
|
|
|
# HTTP is needed for clients such as `curl ip.nc.gy` without an HTTPS scheme.
|
|
# The host UFW rules restrict this port to Cloudflare, just like HTTPS.
|
|
resource "vultr_firewall_rule" "http_v4" {
|
|
firewall_group_id = vultr_firewall_group.rustyip.id
|
|
protocol = "tcp"
|
|
ip_type = "v4"
|
|
subnet = "0.0.0.0"
|
|
subnet_size = 0
|
|
port = "80"
|
|
notes = "Allow HTTP; host UFW limits it to Cloudflare"
|
|
}
|