Terraform for Tyrants: Infrastructure as Code
October 24, 2025
âControl is not about what you build. Itâs about how quickly you can rebuild when the people revolt.â - Kim Jong Rails
Why Dictators Love Infrastructure as Code
Traditional server management is like ruling through fear and manual labor. You SSH into boxes, run commands, hope nothing breaks. When something goes wrong (and it will), you scramble to remember what you did last Tuesday at 3am.
Infrastructure as Code (IaC) is different. Itâs centralized planning meets version control. Every server, every configuration, every firewall ruleâdocumented, versioned, and reproducible with a single command.
The Three Pillars of Digital Tyranny
1. Declarative Configuration (What, Not How)
You donât tell Terraform how to build your infrastructure. You declare what you want, and it makes it happen. Like a decree from the Supreme Leaderâyou just say âI want a server hereâ and the cloud obeys.
resource "hcloud_server" "gitea" { name = "gitea-derails" image = "ubuntu-24.04" server_type = "cx23" location = "fsn1"
public_net { ipv4_enabled = false # IPv6-only: save $0.60/month ipv6_enabled = true }}This isnât a bash script. Itâs a declaration of reality. Terraform reads this and makes it so.
2. Idempotency (Run It 100 Times, Same Result)
Apply this configuration once? You get a server. Apply it again? Nothing changes (unless you modified the declaration). Apply it 100 times? Still the same server. No duplicates, no chaos.
This is crucial for dictators who need predictability. No âoops, I created 101 serversâ moments.
3. State Management (The Secret Police Files)
Terraform maintains a terraform.tfstate fileâa complete record of what exists.
Itâs like the Stasi files for your infrastructure. Terraform knows:
- Every server youâve created
- Every DNS record
- Every SSH key
- What changed since last time
Real Dictator Use Case: The Derails Stack
Our entire infrastructureâGitea server, DNS records, Cloudflare settingsâis defined in ~150 lines of Terraform.
The Server Definition
# Hetzner Cloud Server - IPv6 onlyresource "hcloud_server" "gitea" { name = "gitea-derails" image = "ubuntu-24.04" server_type = "cx23" # 2 vCPU, 4GB RAM, âŹ3.49/mo location = "fsn1" # Falkenstein, Germany
public_net { ipv4_enabled = false # Save $0.60/month ipv6_enabled = true }
ssh_keys = [data.hcloud_ssh_key.default.id]
labels = { service = "gitea" environment = "production" managed_by = "terraform" }
# Automated installation via cloud-init user_data = file("${path.module}/cloud-init-simple.yml")}DNS Configuration
# Cloudflare DNS - git.derails.devresource "cloudflare_dns_record" "gitea" { zone_id = data.cloudflare_zones.derails_dev.result[0].id name = "git" content = hcloud_server.gitea.ipv6_address # Reference the server! type = "AAAA" proxied = true comment = "Gitea - IPv6 only, Cloudflare proxies IPv4"}
# SSL mode: Flexible (Cloudflare terminates SSL)resource "cloudflare_zone_setting" "ssl_flexible" { zone_id = data.cloudflare_zones.derails_dev.result[0].id setting_id = "ssl" value = "flexible"}The One-Command Revolution
Hereâs the beauty: Our entire infrastructure can be destroyed and rebuilt with:
terraform destroy -auto-approve # Burn it downterraform apply -auto-approve # Rise from ashes in 2 minutesTry doing that with ClickOps in the AWS console. Good luck remembering which checkboxes you clicked.
Why This Matters for Resistance
Scenario: GitHub Bans You (Again)
Without IaC: Panic. SSH into servers. Copy files manually. Update DNS by hand. Break things. Cry.
With IaC:
- Change server name in
10-gitea-instance.tf - Run
terraform apply - New server spins up, DNS updates automatically
- Old server gets destroyed
- Youâre back in 3 minutes
Scenario: Migrate to New Provider
Hetzner raises prices? Just swap the provider:
provider "hcloud" {provider "aws" { resource "hcloud_server" "gitea" { resource "aws_instance" "gitea" {Adjust resource parameters, run terraform apply, and youâre on AWS. (Though why would you pay 10x more?)
The Dictatorâs Workflow
1. Plan Before You Act
terraform plan # See what will change BEFORE you applyThis shows you a diff of what Terraform will do. Review it like a five-year plan before committing.
2. Apply Changes
terraform apply # Make it soTerraform shows the plan again and asks for confirmation. Type âyesâ and watch the magic happen.
3. Version Control Everything
git add *.tfgit commit -m "Upgrade to CPX21 for more RAM"git push origin masterYour infrastructure changes are now documented in Git. You can roll back to any previous state.
4. State is Sacred
Never manually edit terraform.tfstate. This is the nuclear codes. Corruption = chaos.
Store it remotely (S3, Terraform Cloud, etc.) for team collaboration. Or keep it local if youâre a solo dictator.
Common Pitfalls (And How to Avoid the Gulag)
â Hardcoding Secrets
# BAD - Never commit secrets!provider "cloudflare" { api_token = "supersecrettoken123"}# GOOD - Use environment variablesprovider "cloudflare" { api_token = var.cloudflare_api_token # Set via TF_VAR_cloudflare_api_token}â Deleting State Files
If you lose terraform.tfstate, Terraform forgets what it created.
Youâll have orphaned resources billing you forever. Back it up!
â Manual Changes in Console
You SSH in and manually edit nginx config? Terraform doesnât know.
Next terraform apply might overwrite your changes. Everything in code.
Advanced Tyranny: Modules
Once you master basic Terraform, create reusable modules:
module "gitea_server" { source = "./modules/gitea"
server_name = "gitea-derails" server_size = "cx23" domain = "git.derails.dev"}
module "blog_server" { source = "./modules/astro-blog"
server_name = "blog-derails" domain = "www.derails.dev"}Now you can spin up identical infrastructure with different parameters. Clone your dictatorship!
The Terraform Tyrantâs Toolkit
- Providers: Hetzner, AWS, Cloudflare, DigitalOcean, etc.
- State backends: S3, Terraform Cloud, Consul
- Tools:
tflint(linter),terraform-docs(documentation) - Validators:
terraform validatebefore committing
Why Every Resistance Needs IaC
Centralized platforms can ban you with a click. But if your infrastructure is code:
- â You can rebuild anywhere, anytime
- â
New team members run
terraform applyand theyâre set - â Disasters become minor inconveniences (restore from Git)
- â You document your setup automatically
- â Auditable: Every change is in Git history
âThe revolution will not be manually configured. It will be terraformed.â - BasharAlCode
Get Started
Our full Terraform configuration is available on our Gitea server. Clone it, modify it, build your own digital sovereignty.
Start small: Define one server. Then add DNS. Then SSL settings. Before you know it, youâre managing entire empires with terraform apply.
Next Steps
- đ Read: HashiCorp Terraform Tutorials
- đŻ Try: Spin up a âŹ3.49/month server on Hetzner
- đ Deploy: Our complete stack from Git