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