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

     1  ---
     2  layout: "docs"
     3  page_title: "Configuring Providers"
     4  sidebar_current: "docs-config-providers"
     5  ---
     6  
     7  # Provider Configuration
     8  
     9  Providers are responsible in Terraform for managing the lifecycle
    10  of a [resource](/docs/configuration/resource.html): create,
    11  read, update, delete.
    12  
    13  Every resource in Terraform is mapped to a provider based
    14  on longest-prefix matching. For example the `aws_instance`
    15  resource type would map to the `aws` provider (if that exists).
    16  
    17  Most providers require some sort of configuration to provide
    18  authentication information, endpoint URLs, etc. Provider configuration
    19  blocks are a way to set this information globally for all
    20  matching resources.
    21  
    22  This page assumes you're familiar with the
    23  [configuration syntax](/docs/configuration/syntax.html)
    24  already.
    25  
    26  ## Example
    27  
    28  A provider configuration looks like the following:
    29  
    30  ```
    31  provider "aws" {
    32  	access_key = "foo"
    33  	secret_key = "bar"
    34  	region = "us-east-1"
    35  }
    36  ```
    37  
    38  ## Description
    39  
    40  The `provider` block configures the provider of the given `NAME`.
    41  Multiple provider blocks can be used to configure multiple providers.
    42  
    43  Terraform matches providers to resources by matching two criteria.
    44  Both criteria must be matched for a provider to manage a resource:
    45  
    46    * They must share a common prefix. Longest matching prefixes are
    47      tried first. For example, `aws_instance` would choose the
    48      `aws` provider.
    49  
    50    * The provider must report that it supports the given resource
    51      type. Providers internally tell Terraform the list of resources
    52      they support.
    53  
    54  Within the block (the `{ }`) is configuration for the resource.
    55  The configuration is dependent on the type, and is documented
    56  [for each provider](/docs/providers/index.html).
    57  
    58  ## Syntax
    59  
    60  The full syntax is:
    61  
    62  ```
    63  provider NAME {
    64  	CONFIG ...
    65  }
    66  ```
    67  
    68  where `CONFIG` is:
    69  
    70  ```
    71  KEY = VALUE
    72  
    73  KEY {
    74  	CONFIG
    75  }
    76  ```