Pattern Execution Model
Each of the five connectivity patterns is an independent Terraform solution with its own state, VPC pair, application stack, and test EC2. Patterns do not share infrastructure and are designed to be run one at a time.
Recommended Workflow
Section titled “Recommended Workflow”For every pattern, follow this cycle:
- Deploy — apply Terraform in the correct order (see below)
- Verify — run connectivity tests via SSM (see Verification)
- Teardown — destroy consumer resources, then shared-services (see Teardown)
- Repeat with the next pattern
Two Terraform Roots per Pattern
Section titled “Two Terraform Roots per Pattern”Every pattern under terraform/patterns/<pattern>/ contains exactly two roots:
| Root | AWS CLI profile | Account |
|---|---|---|
shared-services/ | shared-services | 123456789012 |
consumer/ | dev | 987654321098 |
Upstream Terraform directories:
| Pattern | Shared-services | Consumer |
|---|---|---|
| PrivateLink | privatelink/shared-services | privatelink/consumer |
| VPC Lattice | lattice/shared-services | lattice/consumer |
| VPC Peering | peering/shared-services | peering/consumer |
| Transit Gateway | tgw/shared-services | tgw/consumer |
| Cloud WAN | cloudwan/shared-services | cloudwan/consumer |
Apply Order: Shared-Services Before Consumer
Section titled “Apply Order: Shared-Services Before Consumer”Within each pattern, always apply shared-services first, then consumer. Consumer Terraform roots depend on outputs from the shared-services apply (endpoint service names, TGW IDs, core network ARNs, VPC IDs, and so on). Cross-stack values pass via terraform output exported to shell variables, then supplied as -var arguments — there is no assume_role between roots.
Some patterns require additional shared-services or consumer applies after the initial pair (peering acceptance, TGW route configuration, DNS enablement). Each pattern walkthrough documents the full sequence.
Pattern Complexity Overview
Section titled “Pattern Complexity Overview”| Pattern | Apply steps | Recommended starting point |
|---|---|---|
| PrivateLink | 2 | Yes — simplest pattern |
| VPC Lattice | 2 (+ RAM accept in consumer module) | After PrivateLink |
| VPC Peering | 4 | Medium |
| Transit Gateway | 3 | Medium |
| Cloud WAN | 2 (+ multi-region) | Last — highest cost |
Start with PrivateLink to validate cross-account connectivity before progressing to more complex patterns.