moreserverless.com avatar

moreserverless.com

Terraform for Personal Projects:

A Solo Engineer's Layered Architecture

Project Overview

A colleague mentioned that building everything as a flat pile of Terraform modules wasn't the best approach. That sent me looking for something better.

Solo headaches

Even as a solo developer, hitting these walls is inevitable as complexity grows:

How it works

I split my infrastructure into logical tiers. This makes it easier to reuse components across my projects and keeps specific concerns isolated so I don't break the foundation.

Layer      Responsibility      Typical Resources
Foundation The basics: billing and org structure. Folders, billing accounts.
Network Where traffic flows. VPCs, Subnets, DNS.
Service Common tools for everyone. Databases, GKE, IAM.
Apps Specific project resources. Cloud Run, Pub/Sub.
infrastructure/
├── modules/
│ ├── network/ # (Reusable VPC module)
│ └── database/ # (Reusable Cloud SQL module)
└── layers/
    ├── 00-bootstrap/ # Creates the State Bucket
    ├── 01-networking/ # Uses the bucket, builds VPC
    └── 02-database/ # Uses the bucket, builds DB in VPC

Keeping state safe

I use a central bucket to ensure I can pick up where I left off from any machine.

Managing the flow

Data flows one way: down. Apps look at the Network, not the other way around.

The workflow

I use a disciplined workflow to keep my personal deployments professional and predictable.

  1. Plan first: I always review the execution plan before letting Terraform touch any live infrastructure.
  2. Promote slowly: Sandbox → Staging → Prod. No shortcuts.
  3. Consistency: Use the exact same modules across every environment.

The personal payoff

This approach simplifies my long-term maintenance:

What's Next

This architecture is designed but not yet fully implemented. The layered approach looks clean on paper — the real test is whether the state management and decoupling hold up when I'm actually modifying live infrastructure across multiple projects. I'll document what breaks.