Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

2.2.1. Provider Configuration and Aliases

💡 First Principle: The provider block configures how to talk to a platform (region, credentials, endpoints), and an alias lets you keep several such configurations side by side so each resource can point at the one it needs.

A bare provider block is the default configuration for that provider. Adding alias = "..." creates an additional named configuration:

provider "aws" {
  region = "us-east-1"           # default configuration
}

provider "aws" {
  alias  = "west"
  region = "us-west-2"           # additional configuration
}

resource "aws_instance" "east" {
  # uses the default aws provider
}

resource "aws_instance" "west" {
  provider = aws.west            # explicitly selects the aliased one
}

Resources use the default provider unless they set the provider meta-argument to an aliased reference like aws.west. This is the standard pattern for deploying the same resources across regions or accounts from one configuration.

⚠️ Exam Trap: Don't confuse the provider block (configures a provider instance) with the provider meta-argument (selects which configured instance a resource uses). The block defines the line; the meta-argument dials it.

Reflection Question: Why does deploying to two AWS regions require two provider configurations rather than simply setting a region attribute on each resource?

Alvin Varughese
Written byAlvin Varughese
Founder18 professional certifications