github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/modules/index.html.md (about)

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