Skill 5.1.1

Root and child modules

Key Concepts

The root module is the directory where you run Terraform commands. It can call child modules with module blocks, and child modules can call further modules, forming a tree. A module packages related resources behind an interface of input variables and outputs, so that callers use the pattern without knowing every detail.

Modules can be written by your team or published by others, for example in the public Terraform Registry or an HCP Terraform private registry. Using well-tested modules saves time and spreads standard patterns, but every module added to a configuration is code that runs with your credentials, so review the source and pin versions.