github.com/hugorut/terraform@v1.1.3/website/docs/language/meta-arguments/resource-provider.mdx (about) 1 --- 2 page_title: The Resource provider Meta-Argument - Configuration Language 3 description: >- 4 The provider meta-argument specifies the provider configuration Terraform 5 should use for a resource, overriding Terraform's default behavior. 6 --- 7 8 # The Resource `provider` Meta-Argument 9 10 The `provider` meta-argument specifies which provider configuration to use for a resource, 11 overriding Terraform's default behavior of selecting one based on the resource 12 type name. Its value should be an unquoted `<PROVIDER>.<ALIAS>` reference. 13 14 As described in [Provider Configuration](/language/providers/configuration), you can optionally 15 create multiple configurations for a single provider (usually to manage 16 resources in different regions of multi-region services). Each provider can have 17 one default configuration, and any number of alternate configurations that 18 include an extra name segment (or "alias"). 19 20 By default, Terraform interprets the initial word in the resource type name 21 (separated by underscores) as the local name of a provider, and uses that 22 provider's default configuration. For example, the resource type 23 `google_compute_instance` is associated automatically with the default 24 configuration for the provider named `google`. 25 26 By using the `provider` meta-argument, you can select an alternate provider 27 configuration for a resource: 28 29 ```hcl 30 # default configuration 31 provider "google" { 32 region = "us-central1" 33 } 34 35 # alternate configuration, whose alias is "europe" 36 provider "google" { 37 alias = "europe" 38 region = "europe-west1" 39 } 40 41 resource "google_compute_instance" "example" { 42 # This "provider" meta-argument selects the google provider 43 # configuration whose alias is "europe", rather than the 44 # default configuration. 45 provider = google.europe 46 47 # ... 48 } 49 ``` 50 51 A resource always has an implicit dependency on its associated provider, to 52 ensure that the provider is fully configured before any resource actions 53 are taken. 54 55 The `provider` meta-argument expects 56 [a `<PROVIDER>.<ALIAS>` reference](/language/providers/configuration#referring-to-alternate-provider-configurations), 57 which does not need to be quoted. Arbitrary expressions are not permitted for 58 `provider` because it must be resolved while Terraform is constructing the 59 dependency graph, before it is safe to evaluate expressions.