Infrastructure is split between Terraform and Serverless Framework. Terraform owns shared AWS resources and docs hosting; Serverless owns per-service Lambda stacks and API Gateway methods.
Overview
flowchart TB
subgraph TF[Terraform Cloud]
ECI[env-ci: CircleCI contexts]
EDEV[env-dev: API Gateway, WAF, DynamoDB, S3]
ESTG[env-staging: stage config]
EPROD[env-prod: prod account resources]
EDOCS[env-docs: Cloudflare Pages]
end
subgraph SLS[Serverless via CircleCI]
S1[leads stack]
S2[marketplace stack]
SN[other service stacks]
end
EDEV --> S1
EDEV --> S2
EDEV --> SN
EDOCS --> CF[Cloudflare Pages]
Layer
Tool
Scope
Shared AWS resources
Terraform
platform/terraform/env-*
Per-service Lambda/API Gateway methods
Serverless Framework
services/*/serverless.yml
Docs hosting
Terraform + Cloudflare Pages
platform/terraform/env-docs
CI/CD
CircleCI
.circleci/
Ownership boundaries
Terraform creates the shared API Gateway REST API, custom domains, WAF, shared DynamoDB tables, S3 buckets, and docs hosting resources.
Serverless services read Terraform-published SSM params and attach paths/functions to the shared API.
CircleCI selects which services to package/deploy based on the diff. Changes to shared libs/ can trigger broader service deployment.