github.com/hugorut/terraform@v1.1.3/website/docs/language/modules/index.mdx (about) 1 --- 2 page_title: Modules Overview - Configuration Language 3 description: >- 4 Modules are containers for multiple resources that are used together in a 5 configuration. Find resources for using, developing, and publishing modules. 6 --- 7 8 # Modules 9 10 > **Hands-on:** Try the [Reuse Configuration with Modules](https://learn.hashicorp.com/collections/terraform/modules?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) collection on HashiCorp Learn. 11 12 _Modules_ are containers for multiple resources that are used together. A module 13 consists of a collection of `.tf` and/or `.tf.json` files kept together in a 14 directory. 15 16 Modules are the main way to package and reuse resource configurations with 17 Terraform. 18 19 ## The Root Module 20 21 Every Terraform configuration has at least one module, known as its 22 _root module_, which consists of the resources defined in the `.tf` files in 23 the main working directory. 24 25 ## Child Modules 26 27 A Terraform module (usually the root module of a configuration) can _call_ other 28 modules to include their resources into the configuration. A module that has 29 been called by another module is often referred to as a _child module._ 30 31 Child modules can be called multiple times within the same configuration, and 32 multiple configurations can use the same child module. 33 34 ## Published Modules 35 36 In addition to modules from the local filesystem, Terraform can load modules 37 from a public or private registry. This makes it possible to publish modules for 38 others to use, and to use modules that others have published. 39 40 The [Terraform Registry](https://registry.terraform.io/browse/modules) hosts a 41 broad collection of publicly available Terraform modules for configuring many 42 kinds of common infrastructure. These modules are free to use, and Terraform can 43 download them automatically if you specify the appropriate source and version in 44 a module call block. 45 46 Also, members of your organization might produce modules specifically crafted 47 for your own infrastructure needs. [Terraform Cloud](/cloud) and 48 [Terraform Enterprise](/enterprise) both include a private 49 module registry for sharing modules internally within your organization. 50 51 ## Using Modules 52 53 - [Module Blocks](/language/modules/syntax) documents the syntax for 54 calling a child module from a parent module, including meta-arguments like 55 `for_each`. 56 57 - [Module Sources](/language/modules/sources) documents what kinds of paths, 58 addresses, and URIs can be used in the `source` argument of a module block. 59 60 - The Meta-Arguments section documents special arguments that can be used with 61 every module, including 62 [`providers`](/language/meta-arguments/module-providers), 63 [`depends_on`](/language/meta-arguments/depends_on), 64 [`count`](/language/meta-arguments/count), 65 and [`for_each`](/language/meta-arguments/for_each). 66 67 ## Developing Modules 68 69 For information about developing reusable modules, see 70 [Module Development](/language/modules/develop).