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
| Aspect | Default configuration | Aliased configuration | Passed 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 it | Automatically; no `provider` argument | `provider = aws.west`, a bare reference | Child resources use the mapped configuration |
| Count per provider | Exactly one | Zero or more | One map entry per name the child expects |
| Inherited by a child module | Yes, automatically | No; must be passed explicitly | This is the mechanism that passes one |
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.