- Configure Hetzner Cloud server (CPX22, Ubuntu 24.04) - Manage floating IP (87.99.133.81) - Firewall rules for HTTP, HTTPS, SSH - Persistent volume (40GB) - nginx reverse proxy with SSL (Let's Encrypt) - contact-api (Node.js email backend) - Fix CORS issue: removed proxy_set_header Origin ://; - Include cloud-init for initial provisioning This Terraform config will manage the VPS going forward.
69 lines
2 KiB
HCL
69 lines
2 KiB
HCL
###############################################################################
|
|
# variables.tf
|
|
###############################################################################
|
|
|
|
variable "hcloud_token" {
|
|
description = "Hetzner Cloud API token (read/write). Set via TF_VAR_hcloud_token or terraform.tfvars."
|
|
type = string
|
|
sensitive = true
|
|
}
|
|
|
|
variable "project_name" {
|
|
description = "Short name used to prefix all resources."
|
|
type = string
|
|
default = "krustyplanet"
|
|
}
|
|
|
|
variable "domain" {
|
|
description = "Domain for the website."
|
|
type = string
|
|
default = "krustyplanet.org"
|
|
}
|
|
|
|
variable "ssh_public_key" {
|
|
description = "Your SSH public key (contents of ~/.ssh/id_ed25519.pub or similar)."
|
|
type = string
|
|
}
|
|
|
|
variable "ssh_allowed_ips" {
|
|
description = "CIDRs allowed to reach port 22. Restrict to your actual IP for security."
|
|
type = list(string)
|
|
default = ["0.0.0.0/0", "::/0"] # Tighten this in production!
|
|
}
|
|
|
|
variable "server_type" {
|
|
description = "Hetzner server type."
|
|
type = string
|
|
default = "cx22"
|
|
# cx22 — 2 vCPU / 4 GB RAM — recommended for personal websites
|
|
# cax11 — 2 ARM vCPU / 4 GB — cheapest option (~€3.79/mo post-2026 pricing)
|
|
# cx32 — 4 vCPU / 8 GB — comfortable for a small team
|
|
}
|
|
|
|
variable "location" {
|
|
description = "Hetzner datacenter location."
|
|
type = string
|
|
default = "hel1" # Helsinki, FI — Finnish jurisdiction, strong privacy
|
|
# nbg1 — Nuremberg, DE
|
|
# fsn1 — Falkenstein, DE
|
|
# ash — Ashburn, US
|
|
}
|
|
|
|
variable "network_zone" {
|
|
description = "Hetzner network zone matching your location."
|
|
type = string
|
|
default = "eu-central"
|
|
# us-east or us-west for US locations
|
|
}
|
|
|
|
variable "node_version" {
|
|
description = "Node.js version to install."
|
|
type = string
|
|
default = "20"
|
|
}
|
|
|
|
variable "volume_size_gb" {
|
|
description = "Size of the persistent data volume in GB."
|
|
type = number
|
|
default = 40
|
|
}
|