Skip to content

feat(network): single-VPC foundation stack (ADR 0001 step 2, ground#10) - #25

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/network-single-vpc
Jun 12, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/network-single-vpc

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Build step 2 of ground's network foundation (docs/adr/0001-network-foundation.md) — the TransitGateway:false single-VPC template that delivers the long-promised foundation and is the base the hub-and-spoke expansion (step 3) builds on.

On the CDK question

ground's deploy path is native CloudFormation: every stack builds a cfn.Template (Go maps) → JSON → CloudFormation SDK (internal/deploy). CDK exists only as an optional ground deploy --output cdk export artifact (internal/iac), and that generator is deliberately partial. Building the network stack in CDK would pull the jsii/aws-cdk-go toolchain into go.mod and diverge from all four existing stacks for no deploy benefit — so this follows the established cfn.Template pattern. CDK stays available as an export, not a per-stack dependency.

What network.Stack.Template() emits

  • Private-only VPC (no Internet Gateway) on the deterministic hub /16 from step 1's allocator.
  • One private /20 subnet per AZ (3 by default), region-portable via Fn::GetAZs.
  • Gateway endpoints for S3/DynamoDB (route-table entries, no hourly cost) vs interface endpoints for the rest of NetworkConfig.VPCEndpoints (ENIs in every subnet, private DNS).
  • Each interface endpoint carries an org-conditioned policy: allow same-org aws:PrincipalOrgID against a deploy-time OrgId parameter, deny external — mirrors policies/vpc_endpoint_policy.json; OrgId is resolved like the accounts stack's OrgRootId.

Tested

Template-as-data unit tests (pure, no AWS): VPC CIDR = hub /16, private subnets + no IGW, gateway-vs-interface split, org-scoped policy (Ref OrgId, both Allow and Deny), determinism, default-CIDR, OrgId parameter, outputs. Verified the --dry-run emits valid region-qualified CloudFormation. Full ground suite: 0 failures.

Honest scope

  • Not wired into the live numbered deploy phases yet — surfaced in --dry-run only. The existing deploy loop hardcodes phase numbering ([1/2]…[4/4]); cleanly adding a 5th phase to that brittle orchestration is its own focused change, not bundled into the template PR.
  • Hub-and-spoke + Transit Gateway is step 3; this is the single-VPC degrade path.

Refs: #11, #10.

Build step 2 of docs/adr/0001-network-foundation.md: the TransitGateway:false
single-VPC template the hub-and-spoke expansion (step 3) builds on.

- network.Stack.Template(): private-only VPC (no IGW) on the deterministic hub
  /16; one private /20 subnet per AZ (3 default, region-portable via Fn::GetAZs);
  gateway VPC endpoints for S3/DynamoDB (route-table, no hourly cost); interface
  endpoints for the rest of NetworkConfig.VPCEndpoints, each with an org-conditioned
  policy (allow same-org aws:PrincipalOrgID vs a deploy-time OrgId param, deny
  external — mirrors policies/vpc_endpoint_policy.json; OrgId resolved like the
  accounts stack's OrgRootId).
- New(cfg, org): org supplies region (endpoint service names are region-qualified)
  + the org-id anchor. Wired into ground deploy --dry-run.
- Built as cfn.Template (Go maps -> JSON -> CloudFormation SDK) like the other four
  stacks. Native CloudFormation is ground's deploy path; CDK stays an optional
  --output cdk export, not a per-stack dependency.
- template-as-data tests: VPC CIDR (hub /16), private subnets + no-IGW, gateway-vs-
  interface split, org-scoped policy (Ref OrgId, Allow+Deny), determinism, default
  CIDR, OrgId param, outputs.

Live-deploy numbered-phase wiring + hub-and-spoke/TGW (step 3) are follow-ups.

Refs: #11, #10
@scttfrdmn
scttfrdmn merged commit 8fa77b6 into main Jun 12, 2026
2 checks passed
@scttfrdmn
scttfrdmn deleted the feat/network-single-vpc branch June 12, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant