~/bpabatao
← back to index

Terraform Control-Plane & Internal Developer Platform

The internal developer platform that provisions new client environments, cost-tracks the fleet, and is absorbing the rest tenant by tenant.

Role
Primary author and operator
Period
2026 - present
Ownership
93% of commits
Stack
Terraform · Fastify 5 · React 18 · TypeScript · MongoDB · AWS SDK v3 · ECS Fargate
provisioning dashboardplan · apply · drift · tags · costterraform control-plane · 9 stackscognito · ecs fargate · cloudfront · wafv2route 53 · elasticache · kms · secrets managerdeltamvunepdelcoalexrenewcarmelaruba7 livetenantsdashed: migrating onto it, tenant by tenant
The provisioning dashboard drives the Terraform control-plane that new tenant environments are provisioned from; the 7 live tenants (dashed) are migrating onto it

Problem

Client environments were assembled by hand: per-portal Terraform where it existed, console clicks where it did not, drift nobody could see, and an AWS bill nobody could attribute. Onboarding a tenant took days of a senior engineer's attention, and each environment came out slightly different from the last.

Constraints

I was the primary platform engineer, owning the AWS across the production and test fleets alongside feature work. Provisioning had to work without me in the room, and drift and cost anomalies had to show up without someone going looking for them.

Decisions

Architecture

Nine Terraform stacks covering ~60 AWS resource types: Cognito user pools, ECS Fargate services, CloudFront distributions, WAFv2, Route 53, ElastiCache, KMS, Secrets Manager. Tenant environments are instantiated from templated modules, so each one has the same shape. The modules were imported from the fleet's earlier per-portal Terraform in March 2026 and consolidated. Colleagues contributed the other 7% of commits: Entra ID SSO for the admin portal, the clients tab and onboarding wizard, the production backend deploy path, and per-client state isolation with a plan-approval gate.

Where it stands: the control-plane state owns one deployed tenant awaiting launch, the shared ALB and WAF, and the first migrating tenant's v2 stack, now running beside its v1. The live fleet still runs on its earlier per-portal Terraform.

On top sits a Fastify + React dashboard that runs Terraform plans and applies, detects drift against live state, enforces tag compliance, and attributes cost per client through the Cost Explorer API. Load balancer spend fell about 57% after shared production and test load balancers were created in April 2026, and the test fleet runs on Fargate Spot.

Delivery

Blocking Snyk scans were rolled onto the newer portal pipelines and both API repos, and deploys on four repositories authenticate through keyless OIDC, taking long-lived keys out of their deploy paths.

The admin portal's run went from about ten minutes to six in April 2026 by merging lint into the build and running the security scan in parallel; the core API's went from twelve to seven with esbuild transpile, cache-mounted installs and fail-fast, and the twenty-minute build hangs ended when the stale registry cache was dropped.

Outcome

view resume ↗ (opens in new tab)email me