github.com/hs0210/hashicorp-terraform@v0.11.12-beta1/website/docs/registry/modules/use.html.md (about)

     1  ---
     2  layout: "registry"
     3  page_title: "Finding and Using Modules from the Terraform Registry"
     4  sidebar_current: "docs-registry-use"
     5  description: |-
     6    The Terraform Registry makes it simple to find and use modules.
     7  ---
     8  
     9  # Finding and Using Modules
    10  
    11  The [Terraform Registry](https://registry.terraform.io) makes it simple to
    12  find and use modules.
    13  
    14  ## Finding Modules
    15  
    16  Every page on the registry has a search field for finding
    17  modules. Enter any type of module you're looking for (examples: "vault",
    18  "vpc", "database") and resulting modules will be listed. The search query
    19  will look at module name, provider, and description to match your search
    20  terms. On the results page, filters can be used further refine search results.
    21  
    22  By default, only [verified modules](/docs/registry/modules/verified.html)
    23  are shown in search results. Verified modules are reviewed by HashiCorp to
    24  ensure stability and compatibility. By using the filters, you can view unverified
    25  modules as well.
    26  
    27  ## Using Modules
    28  
    29  The Terraform Registry is integrated directly into Terraform. This makes
    30  it easy to reference any module in the registry. The syntax for referencing
    31  a registry module is `<NAMESPACE>/<NAME>/<PROVIDER>`. For example:
    32  `hashicorp/consul/aws`.
    33  
    34  ~> **Note:** Module registry integration was added in Terraform v0.10.6, and full versioning support in v0.11.0.
    35  
    36  When viewing a module on the registry on a tablet or desktop, usage instructions
    37  are shown on the right side.
    38  You can copy and paste this to get started with any module. Some modules
    39  have required inputs you must set before being able to use the module.
    40  
    41  ```hcl
    42  module "consul" {
    43    source = "hashicorp/consul/aws"
    44    version = "0.1.0"
    45  }
    46  ```
    47  
    48  The `terraform init` command will download and cache any modules referenced by
    49  a configuration.
    50  
    51  ### Private Registry Module Sources
    52  
    53  You can also use modules from a private registry, like the one provided by
    54  Terraform Enterprise. Private registry modules have source strings of the form
    55  `<HOSTNAME>/<NAMESPACE>/<NAME>/<PROVIDER>`. This is the same format as the
    56  public registry, but with an added hostname prefix.
    57  
    58  ```hcl
    59  module "vpc" {
    60    source = "app.terraform.io/example_corp/vpc/aws"
    61    version = "0.9.3"
    62  }
    63  ```
    64  
    65  Depending on the registry you're using, you might also need to configure
    66  credentials to access modules. See your registry's documentation for details.
    67  [Terraform Enterprise's private registry is documented here.](/docs/enterprise/registry/index.html)
    68  
    69  Private registry module sources are supported in Terraform v0.11.0 and
    70  newer.
    71  
    72  ## Module Versions
    73  
    74  Each module in the registry is versioned. These versions syntactically must
    75  follow [semantic versioning](http://semver.org/). In addition to pure syntax,
    76  we encourage all modules to follow the full guidelines of semantic versioning.
    77  
    78  Terraform since version 0.11 will resolve any provided
    79  [module version constraints](/docs/modules/usage.html#module-versions) and
    80  using them is highly recommended to avoid pulling in breaking changes.
    81  
    82  Terraform versions after 0.10.6 but before 0.11 have partial support for the registry
    83  protocol, but always download the latest version instead of honoring version
    84  constraints.