Terraform module

A Terraform module is a reusable package of Terraform configuration that groups related resources, such as a VPC with its subnets and route tables. Modules take input variables and return outputs, so teams can create the same infrastructure pattern many times without copying code.

Every Terraform configuration is a module: the root module is the directory you run Terraform in. Child modules are called with a module block and can come from a local path, a Git repository or the Terraform Registry. Popular community modules include the terraform-aws-modules collection.

Modules are also a governance tool. A shared module can bake in encryption, tagging and network rules so every team inherits them. That only holds if module versions are pinned and changes are reviewed.