github.com/iaas-resource-provision/iaas-rpc@v1.0.7-0.20211021023331-ed21f798c408/website/docs/language/modules/index.html.md (about)

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