krustyplanet.org/terraform/README.md
Jezza Hehn b1fde182bf Add Terraform configuration for KrustyPlanet VPS
- 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.
2026-04-13 22:14:11 +00:00

53 lines
1.3 KiB
Markdown

# KrustyPlanet Terraform
Terraform configuration for the KrustyPlanet VPS on Hetzner Cloud.
## What's Managed
- Hetzner server (CPX22, Ubuntu 24.04)
- Floating IP (87.99.133.81)
- Firewall rules (80, 443, 22)
- Persistent volume (40GB)
- nginx reverse proxy
- contact-api (Node.js email backend)
- SSL certificates (Let's Encrypt)
## Usage
```bash
# Initialize
terraform init
# Validate
terraform validate
# Plan
terraform plan
# Apply
terraform apply
```
## Variables
See `variables.tf` for all configurable variables.
Sensitive variables are stored in `terraform.tfvars`.
## Files
- `main.tf` — Main Terraform configuration
- `variables.tf` — Variable definitions
- `provider.tf` — Provider configuration
- `terraform.tfvars` — Sensitive variable values (gitignored)
- `cloud-init.yaml.tpl` — Server bootstrap script
- `nginx.conf.tpl` — nginx configuration template
- `contact-api.conf.tpl` — contact-api proxy configuration
- `contact-api.service.tpl` — contact-api systemd service
## Notes
- Do NOT run `terraform apply` unless you want to recreate the server
- Existing VPS configuration is preserved; this Terraform config will be used for future provisioning
- SSL certificates are provisioned via Let's Encrypt
- The floating IP is attached to the server and will survive rebuilds