Ad · 728×90 desktop · 320×50 mobile

Infrastructure-as-code patterns that last

Published 2026-04-24 · Cloud Migration

Every IaC repo starts clean. Most end up a mess by year 2. Here's what separates the ones that don't.

The patterns that scale

1. Module boundaries match team boundaries

Each team owns their modules. Other teams consume via published versions. No circular dependencies.

2. State per environment, per team

Not one giant state file. Not state per resource. Somewhere in between. Typical: {team}/{environment}/ structure.

3. Variables are inputs, not constants

Anything that differs between environments is a variable. Anything that's identical is hardcoded (for clarity) or in a module (for reuse).

4. Version pinning everywhere

Terraform version. Provider versions. Module versions. Pinned. When you don't pin, your CI/CD becomes a time bomb.

The anti-patterns

The mega-module

One module that does everything. 2,000 lines. Any change breaks unrelated things.

The giant state file

All resources in one Terraform state. Plans take 10+ minutes. Two engineers can't work simultaneously.

The ad-hoc terraform apply

Engineers apply from their laptops. CI/CD applies from somewhere else. State drift. Nobody trusts plans.

The unversioned module

Modules referenced by Git branch. Random change to the module breaks all consumers.

Migration path

From mess to clean:

  1. Inventory your modules
  2. Split by team
  3. Pin versions
  4. Migrate state file structure
  5. Move applies to CI/CD only

Takes 3-6 months. Worth it.

Tools

Ad · 300×250 responsive

Joined by engineers at enterprises running the systems you build. No spam. No tracking in the emails.