Multiple accounts and region boundaries
Account boundaries are not region boundaries
Two regions in one account can share an identity and billing boundary. Two accounts in one region can have completely different permissions and owners. Treat region, account, credential source, state location and execution identity as separate decisions. The following fictional configuration demonstrates only naming and intent, not authentication.
provider "demo" { alias = "dev" region = "region-a" account = "fictional-dev"}
provider "demo" { alias = "prod" region = "region-a" account = "fictional-prod"}The account argument is part of the imaginary provider schema, not portable Terraform syntax for real providers. A real provider may use a project, subscription, tenant, account guard or other settings; consult its pinned documentation. An alias called prod grants no permission by itself.
Choose the state and execution boundary
Imagine a development catalog and a production catalog owned by different teams. A combined root state would allow anyone with sufficient state and execution access to potentially affect both, depending on credentials. Prefer separate roots, backend access policies, short-lived execution identities and approvals when the trust boundaries differ. Use two aliases within one root only when the operation genuinely needs coordinated access and the owner accepts the shared blast radius. State separation is not a substitute for provider authorization.
dev root -> dev state -> dev execution identity -> dev accountprod root -> prod state -> prod execution identity -> prod accountExchange narrowly defined, approved outputs through a controlled interface when roots need shared information. Avoid granting full state read access merely to share a public identifier; state can contain secrets.
Review the target before changes
For an authorized live workflow, reviewers should confirm the exact provider package and lockfile, provider configuration, expected account and region, backend/workspace, execution identity, resource addresses and plan actions. Check actual identity using the provider-specific approved mechanism only after permission is established. This lesson performs no authentication or API calls. Do not trust a profile name, a workspace name or a tag as proof of the real target. Never embed actual access keys in provider blocks or plan artifacts.
Retire a provider alias safely
Suppose state still binds demo_record.replica to demo.secondary. Removing its configuration while that binding is needed can leave Terraform unable to operate on the recorded object. Retain the old configuration while reviewing the intended migration or removal. If the object is no longer needed, remove its resource configuration with the provider still available, review the deletion and verify completion before removing the alias. If the object must remain, plan an explicitly supported adoption or migration with its owner; do not assume changing region or account on a provider moves infrastructure.
Before: demo_record.replica -> demo.secondary -> region-bProposed: remove demo.secondary while the state binding remainsDecision: reject; preserve the configuration and resolve ownership firstA moved block changes Terraform addresses, not cloud geography. Never edit state JSON or remove state bindings merely to silence a missing-provider diagnostic.
Practice a two-account review
Use the synthetic review cases. For each, identify the intended account, region, identity and state; decide approve for design review or block. Approval here means the fictional design satisfies the stated checks, not permission to deploy. Explain why a region change may require replacement, migration or provider-specific handling rather than a universal outcome. No real cloud or provider behavior is asserted.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Multiple accounts and region boundaries — knowledge check
Review provider selection, account boundaries and safe lifecycle.
Which proves that the production alias has permission?
What is a suitable default for unrelated dev and prod trust boundaries?
When state still needs an alias, what should you do?
Does changing a provider region automatically migrate an existing object?
What should a reviewer confirm before a real change?