Skip to content
Nubent

/Terraform · IaC · DevOps · 6 min

Terraform: avoid modules nobody dares to change

Reuse does not mean turning all infrastructure into one module with fifty variables.

In one sentence

A good module encapsulates a stable decision and lets the root module compose the architecture.

Premature abstraction is expensive

A module built for every project accumulates flags, conditionals and confusing outputs. It is reusable in theory and risky to change in practice.

A structure that usually works

  • Root modules by environment or system: compose resources and deployment decisions.
  • Small modules: encapsulate repeated patterns with one responsibility.
  • Pinned versions: prevent unreviewed shared changes.
  • Plans in pull requests: expose impact before apply.

What should not become a variable

If an option breaks the security model or creates a different architecture, it likely deserves another module. Useful flexibility keeps contracts clear.

Refactor without stopping production

Stabilize providers, state and pipelines first. Then extract modules without recreating resources, using reviewable plans and small changes.

Sources

Next step

What should we build next on AWS?

30 minutes with an engineer. Concrete next steps, whether or not you work with us.