Interview Prep/Terraform/Modules and Code Structure

Where should you document modules so people actually use them correctly?

BeginnerScenarioModules and Code Structure
Answer

Situation read → Undocumented modules get copied and forked.

What I'd do →

  1. Add a README per module with purpose, an example call and inputs/outputs.
  2. Generate the tables with terraform-docs via pre-commit so they never go stale.
  3. Include an examples/basic directory that CI actually plans.
terraform-docs markdown table --output-file README.md --output-mode inject ./modules/vpc

Why → Generated docs match the code; tested examples prove the README works.

Interview tip → Also write descriptions on every variable and output.

All Terraform questions Roadmap: Terraform

More on Modules and Code Structure