github.com/atsaki/terraform@v0.4.3-0.20150919165407-25bba5967654/website/source/docs/configuration/modules.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Configuring Modules"
     4  sidebar_current: "docs-config-modules"
     5  description: |-
     6    Modules are used in Terraform to modularize and encapsulate groups of resources in your infrastructure. For more information on modules, see the dedicated modules section.
     7  ---
     8  
     9  # Module Configuration
    10  
    11  Modules are used in Terraform to modularize and encapsulate groups of
    12  resources in your infrastructure. For more information on modules, see
    13  the dedicated
    14  [modules section](/docs/modules/index.html).
    15  
    16  This page assumes you're familiar with the
    17  [configuration syntax](/docs/configuration/syntax.html)
    18  already.
    19  
    20  ## Example
    21  
    22  Module configuration looks like the following:
    23  
    24  ```
    25  module "consul" {
    26  	source = "github.com/hashicorp/consul/terraform/aws"
    27  	servers = 5
    28  }
    29  ```
    30  
    31  ## Description
    32  
    33  The `module` block configures a module and tells Terraform to build
    34  its resources. Multiple module blocks may be used to configure and use
    35  multiple modules.
    36  
    37  The NAME of the module is logical: it is used only to reference the
    38  module in other places in the configuration. It has no effect on the
    39  source of the module. Therefore, you may name modules whatever you'd like.
    40  
    41  Within the block (the `{ }`) is configuration for the module.
    42  The only required key is `source`, which tells Terraform where this module
    43  can be downloaded from. Valid source values are covered in more detail
    44  in the
    45  [module section](/docs/modules/index.html).
    46  
    47  Other configuration within the module are dependent on the module itself.
    48  Because module configuration maps directly to
    49  [variables](/docs/configuration/variables.html) within the module, they
    50  are always simple key and string values. Complex structures are not used
    51  for modules.
    52  
    53  ## Syntax
    54  
    55  The full syntax is:
    56  
    57  ```
    58  module NAME {
    59  	source = SOURCE_URL
    60  
    61  	CONFIG ...
    62  }
    63  ```
    64  
    65  where `CONFIG` is:
    66  
    67  ```
    68  KEY = VALUE
    69  ```