Interview Prep/Terraform/Modules and Code Structure

How do you release a shared module so consumers can upgrade at their own pace?

IntermediateScenarioModules and Code Structure
Answer

Situation read → Many stacks depend on one module, and a breaking change must not hit them all at once.

What I'd do →

  1. Keep modules in their own repo (or path with tags) and release with SemVer tags: v1.4.0.
  2. Consumers pin: source = "git::https://github.com/acme/tf-modules.git//vpc?ref=v1.4.0".
  3. Maintain a CHANGELOG and flag breaking changes with a major bump and migration notes (and moved blocks).

Why → Pinned versions mean consumers upgrade when ready, and moved blocks shipped inside the module make renames painless.

Interview tip → Branch references like ref=main are a production incident waiting to happen.

All Terraform questions Roadmap: Terraform

More on Modules and Code Structure