github.com/bengesoff/terraform@v0.3.1-0.20141018223233-b25a53629922/website/source/docs/configuration/modules.html.md (about)

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