Interview Prep/Terraform/Providers, Resources and Data Sources

How do you use the same provider with multiple regions or accounts?

IntermediateConceptProviders, Resources and Data Sources
Answer

Add a second provider block with an alias, then select it with the provider meta-argument on resources or pass it to modules.

provider "aws" { alias = "use1"  region = "us-east-1" }

resource "aws_acm_certificate" "cf" {
  provider    = aws.use1
  domain_name = "example.com"
  validation_method = "DNS"
}
All Terraform questions Roadmap: Terraform

More on Providers, Resources and Data Sources