Skip to content

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.

For every pattern, follow this cycle:

  1. Deploy — apply Terraform in the correct order (see below)
  2. Verify — run connectivity tests via SSM (see Verification)
  3. Teardown — destroy consumer resources, then shared-services (see Teardown)
  4. Repeat with the next pattern

Every pattern under terraform/patterns/<pattern>/ contains exactly two roots:

RootAWS CLI profileAccount
shared-services/shared-services123456789012
consumer/dev987654321098

Upstream Terraform directories:

PatternShared-servicesConsumer
PrivateLinkprivatelink/shared-servicesprivatelink/consumer
VPC Latticelattice/shared-serviceslattice/consumer
VPC Peeringpeering/shared-servicespeering/consumer
Transit Gatewaytgw/shared-servicestgw/consumer
Cloud WANcloudwan/shared-servicescloudwan/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.

PatternApply stepsRecommended starting point
PrivateLink2Yes — simplest pattern
VPC Lattice2 (+ RAM accept in consumer module)After PrivateLink
VPC Peering4Medium
Transit Gateway3Medium
Cloud WAN2 (+ multi-region)Last — highest cost

Start with PrivateLink to validate cross-account connectivity before progressing to more complex patterns.