73 lines
1.7 KiB
Terraform
73 lines
1.7 KiB
Terraform
# dev: Gitea + Runner + Traefik (git.luke-else.co.uk, cicd.luke-else.co.uk)
|
|
|
|
# Port sources: services/dev/*docker-compose.yml (published ports) and services/todo.md
|
|
# (the documented UFW allow-list). dev has no firewall in docs/architecture.md, but we
|
|
# add one anyway for baseline safety - see conversation history.
|
|
resource "hcloud_firewall" "this" {
|
|
name = "dev-firewall"
|
|
|
|
rule { # server ssh
|
|
direction = "in"
|
|
protocol = "tcp"
|
|
port = "22"
|
|
source_ips = var.allowed_ssh_source_ips
|
|
}
|
|
|
|
rule { # gitea ssh (git.luke-else.co.uk, published as 222:22)
|
|
direction = "in"
|
|
protocol = "tcp"
|
|
port = "222"
|
|
source_ips = ["0.0.0.0/0", "::/0"]
|
|
}
|
|
|
|
rule { # Traefik http/https (git.luke-else.co.uk, cicd.luke-else.co.uk)
|
|
direction = "in"
|
|
protocol = "tcp"
|
|
port = "80"
|
|
source_ips = ["0.0.0.0/0", "::/0"]
|
|
}
|
|
|
|
rule {
|
|
direction = "in"
|
|
protocol = "tcp"
|
|
port = "443"
|
|
source_ips = ["0.0.0.0/0", "::/0"]
|
|
}
|
|
|
|
rule { # traffic from prod over the private network
|
|
direction = "in"
|
|
protocol = "tcp"
|
|
port = "1-65535"
|
|
source_ips = [var.network_ip_range]
|
|
}
|
|
|
|
rule {
|
|
direction = "in"
|
|
protocol = "udp"
|
|
port = "1-65535"
|
|
source_ips = [var.network_ip_range]
|
|
}
|
|
}
|
|
|
|
resource "hcloud_server" "this" {
|
|
name = "dev"
|
|
server_type = var.server_type
|
|
image = var.image
|
|
location = var.location
|
|
ssh_keys = [var.ssh_key_id]
|
|
firewall_ids = [hcloud_firewall.this.id]
|
|
|
|
network {
|
|
network_id = var.network_id
|
|
ip = var.private_ip
|
|
}
|
|
}
|
|
|
|
resource "hcloud_volume" "storage" {
|
|
name = "dev-storage"
|
|
size = var.volume_size
|
|
server_id = hcloud_server.this.id
|
|
automount = true
|
|
format = "ext4"
|
|
}
|