provider alias
What is provider alias?
provider alias: Lets you configure the same provider more than once (e.g. two AWS regions) and pick which one a resource uses. A provider alias lets you configure the same Terraform provider more than once, for example AWS in two regions or two different accounts. Each configuration gets an alias, and resources choose one with provider = aws.us.
Frequently asked questions about provider alias
How is provider alias used in practice?
A common case is TLS certificates for CloudFront, which must be created in the us-east-1 region even when the rest of your infrastructure lives in Europe. Another is managing resources in a production and a staging account from one configuration.
What should you keep in mind with provider alias?
Modules that need a specific aliased provider receive it through a providers map when they are called. Keep aliases descriptive, such as aws.us_east or aws.prod, so it is obvious where each resource ends up. A resource in the wrong region is easy to create and annoying to move later.
What does an example of provider alias look like?
provider "aws" { alias = "us" region = "us-east-1" } resource "aws_acm_certificate" "cdn" { provider = aws.us } At a glance
| Category | Terraform |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |