Multi-cloud architecture decisions
Start with a workload, not a cloud list
Multi-cloud means using more than one cloud provider; hybrid architecture connects cloud workloads to infrastructure operated outside the public cloud, such as a company data center. They can overlap, but neither is a requirement for using Terraform. Consider a fictional catalog API with private application instances, HTTPS ingress, an approved data location and a recovery objective. Start by deciding why a second provider is needed: an existing acquisition, a regulatory constraint, a required capability or an independently justified availability objective. A single cloud across suitable failure domains may meet the same requirements with less operational effort. Terraform supplies a common configuration and review workflow, not interchangeable cloud services. Compare these candidates, not an assertion of equivalence.
Requirement: private application network with HTTPS ingressAWS: VPC + subnets + Application Load Balancer candidateAzure: VNet + subnets + Application Gateway candidateGoogle Cloud: VPC + regional subnets + Application Load Balancer candidateReview each service scope, TLS, routing, firewall and health-check behavior.Compare actual provider semantics
An AWS VPC is regional and its subnets are associated with Availability Zones. An Azure VNet is regional; its subnets are not inherently tied to a single availability zone. A conventional global Google Cloud VPC contains regional subnets. Check the exact network product and scope before reusing a design. The AWS account, Azure tenant/subscription/resource group and Google Cloud organization/project boundaries also play different roles in access, billing and governance. A common module variable called region cannot erase these distinctions. Compare firewall enforcement and direction, load-balancer scope, health-check behavior, supported TLS termination, private service access, storage replication and deletion semantics individually. A matching resource name does not prove a matching capability. See the Google networking documentation and earlier provider chapters.
Requirement: two failure domainsAWS: select suitable subnets in distinct AZsAzure: verify zone support for each selected serviceGoogle Cloud: select appropriate regional subnet and zonal or regional service placementAcceptance: independently verify loss of one intended failure domainCompose provider-specific implementations behind a small contract
Keep the cloud-specific modules responsible for native resources. At a shared boundary expose only data consumers need, such as an application DNS name, an address range or a published service identifier. A typed input catches some shape errors but does not establish that the address is valid, reachable or authorized. The following complete local configuration demonstrates a versioned input interface, not a cloud module. Save the two files in a disposable directory; no external provider is required. The expected output is catalog.example.com; this example was not executed in Terraform.
variable "network_contract" { type = object({ schema_version = number cidr = string service_dns = string }) validation { condition = var.network_contract.schema_version == 1 error_message = "Expected network contract version 1." }}
output "service_dns" { value = var.network_contract.service_dns}network_contract = { schema_version = 1 cidr = "10.20.0.0/16" service_dns = "catalog.example.com"}If a new version adds a required field, review every consumer before upgrading. Keep provider-specific information explicit where it affects security or operation. Prefer a versioned contract plus documented behavioral tests over an abstraction that exposes only the least common denominator. See https://developer.hashicorp.com/terraform/language/modules/develop/composition.
Choose roots and state by ownership
A single root can manage several provider configurations, but a plan or failure may span multiple environments. Use separate roots and state when teams, credentials, lifecycle or approval rules differ. An alias selects a provider configuration; it is not itself a security boundary. A separate state also does not constrain a principal with broad cloud permissions. For independent ownership, combine separate backend keys and access policies, scoped short-lived credentials and independently approved pipelines. Terraform does not provide an atomic transaction spanning providers or separate states.
roots/ aws-catalog/ -> AWS-only principal, backend A azure-catalog/ -> Azure-only principal, backend B gcp-catalog/ -> GCP-only principal, backend C connectivity/ -> separately approved connectivity ownershipAvoid managing the same object from more than one root. Publish narrowly scoped configuration through an approved store or service catalog. A consumer of terraform_remote_state may need access to the full underlying state snapshot even though the Terraform expression exposes only outputs; prefer narrower access where possible. See https://developer.hashicorp.com/terraform/language/state/remote-state-data.
Evaluate the economics and operating model
Compare cost under the same traffic and availability assumptions: compute, storage, licenses, network gateways, cross-provider egress, standby capacity, monitoring and personnel. For a hypothetical design, 800 GB transferred at an invented rate of $0.08 per GB and two gateways at an invented $35 monthly cost each total $134 before other costs. These are not provider quotes. A second cloud can reduce a particular dependency while introducing new ones, such as DNS, identity, release tooling and on-call expertise. Document the reason for adoption, measurable success conditions, owner, dependencies and exit plan. Do not equate portability of HCL with portability of data or runtime behavior.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Multi-cloud architecture decisions — knowledge check
Review multi-cloud architecture and hybrid connectivity.
What does Terraform make portable across cloud providers?
Which scope distinction matters for a conventional Google Cloud VPC?
What is a provider alias by itself?
Why prefer a published minimal configuration contract over broad remote state access?
What does a typed module interface establish?