The unit of reuse in Terraform — how a directory of configuration becomes a versioned, black-box component with a typed interface, sourced and pinned the way you pin a library.
7 topics
A module is just a directory of .tf files you call with inputs — and that small idea is how you stop copy-pasting a VPC definition across ten projects and start versioning one. Every configuration is already a module: the directory you run Terraform in is the root module, and the moment it calls another directory with a module block, you are composing.
This chapter is about that composition. What a module is and what its interface consists of, how inputs and outputs form a contract, how you source and pin a module so the build is reproducible, the public Registry and its widely-used AWS modules, version constraints and the ~> operator, how to compose modules without nesting them into a maze, and finally the principles that make a module others adopt happily instead of forking in frustration.