github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/meta-arguments/resource-provider.html.md (about)

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