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"
}
More on Providers, Resources and Data Sources
What is a resource block and how is it addressed?BeginnerWhat is the difference between a resource and a data source?BeginnerHow do you configure a provider such as AWS?BeginnerIn what order does the AWS provider look for credentials?IntermediateWhat does `default_tags` in the AWS provider do and what are its pitfalls?IntermediateWhat is the difference between arguments and attributes?Beginner