When Terraform Modules Create More Problems Than They Solve

Modules are often treated as the default “correct” way to structure Terraform.

That assumption breaks down quickly.

A module introduces an interface.
An interface introduces constraints.
If the configuration is used once, that constraint adds cost without reducing duplication.

The real issue shows up during refactoring.

Moving a resource into a module changes its address in state.
Without explicitly preserving identity, Terraform may plan to replace infrastructure that already exists.

That is not a theoretical risk.
It is a direct result of how Terraform maps configuration to state.

This lesson focuses on restraint.

Use modules when patterns repeat and interfaces stabilize.
Avoid them when the design is still evolving or used only once.

The goal is not abstraction.
The goal is correct, predictable infrastructure behavior.

https://youtu.be/-EF5Pcy9Bvs