Domain 2 of 8 · Chapter 3 of 4

Writing configuration with multiple providers

Unlock the complete study guide + 1,040 practice questions across 16 full exams.

Bundled into the existing HashiCorp Certified: Terraform Associate premium course — no separate purchase.

14-day money-back guarantee — no questions asked.

Included in this chapter:

  • The default provider configuration
  • Multiple configurations with alias
  • Passing providers to modules
  • Exam-pattern recognition

How a resource or module binds to a provider configuration

AspectDefault configurationAliased configurationPassed to a module
How it is declared`provider "aws" {}` with no `alias``provider "aws" { alias = "west" }``providers = { aws = aws.west }` in the `module` block
How a resource selects itAutomatically; no `provider` argument`provider = aws.west`, a bare referenceChild resources use the mapped configuration
Count per providerExactly oneZero or moreOne map entry per name the child expects
Inherited by a child moduleYes, automaticallyNo; must be passed explicitlyThis is the mechanism that passes one

Cheat sheet

  • The provider block
  • The default provider configuration
  • Provider arguments are often optional
  • The alias meta-argument
  • Selecting an aliased provider on a resource
  • Unmarked resources still use the default config
  • Child modules inherit the default provider
  • Explicitly passing providers to a module

Unlock with Premium — includes all practice exams and the complete study guide.

References

  1. Provider configuration (default configuration, alias, provider meta-argument)
  2. Providers within modules (inheritance and passing providers)
  3. Provider requirements (required_providers, configuration_aliases)