By Meena Nukala
Senior DevOps Engineer | 10+ years | Terraform Associate, AWS DevOps Pro, CKA, CKS
Published: 11 December 2025
In 2024 I inherited a 180,000-line Terraform monorepo that took 68 minutes to plan and made every developer hate Fridays.
Nine months later we run 42 clean multi-repos, plan times are under 2 minutes, and no one wakes up for failed runs anymore.
Here’s the exact playbook we used — zero downtime, zero data loss, zero tears.
The Monorepo Nightmare (Early 2024)
- Single repo, 180 k LoC, 2,800 resources
-
terraform plan: 68–94 minutes - 27 failed runs per week from merge conflicts
- State file: 1.9 GB (yes, gigabytes)
- One junior typo in networking → entire company blocked
The Final Multi-Repo Layout (Now)
infra/
├─ org-global/ ← org-level providers, remote backend
├─ platform/ ← EKS, VPC peering, Route53
├─ security/ ← IAM roles, GuardDuty
├─ team-alpha/
├─ team-bravo/
└─ team-gamma/
Each team repo < 4,000 lines, fully independent.
The 5-Phase Migration That Actually Worked
Phase 1 – Freeze & Fork (Week 1)
# Created immutable branch "monorepo-frozen-2024-03-01"
git checkout -b monorepo-frozen-2024-03-01
Phase 2 – State Surgery (The Scary Part)
Used my open-source splitter tool:
https://github.com/meenanukala/terraform-state-migrator
# Example: extract team-alpha state
terraform state mv -state-out=team-alpha.tfstate \
module.vpc module.team_alpha_vpc
terraform state mv -state-out=team-alpha.tfstate \
aws_eks_cluster.alpha null
# Repeated 42 times with automation
Phase 3 – Repository Explosion
Scripted creation of 42 new repos with:
- Correct .tfversion constraints
- Backend config pointing to dedicated S3+DynamoDB tables
- README + CODEOWNERS + pre-commit hooks
Phase 4 – Atlantis + OpenTofu Switch (The Big Performance Win)
Moved from Terraform 1.5 + Terraform Cloud → OpenTofu 1.8 + Atlantis 4.0
Result: plan time 68 min → 1.8 min average
Key Atlantis config:
repos:
- id: /meenanukala/*
apply_requirements: [approved, mergeable]
workflow: tofu
workflows:
tofu:
plan:
steps:
- init
- plan:
extra_args: ["-lock-timeout=5m"]
apply:
steps:
- apply
Phase 5 – Safety Nets & Governance
- Infracost + tfsec in every PR
- Custom pre-commit hook that blocks state file commits
- Dependabot for providers
- Weekly automated drift detection
Hard Numbers (Dec 2025)
| Metric | Monorepo | Multi-Repo | Improvement |
|---|---|---|---|
| Average plan time | 68 min | 1.8 min | 97 % faster |
| Failed runs per week | 27 | 0.8 | 97 % reduction |
| PR merge time | 4.2 hours | 18 minutes | 93 % faster |
| State file size (largest) | 1.9 GB | 38 MB | |
| Engineer happiness score | 4.8/10 | 9.6/10 |
The One-Click Migration Toolkit I Open-Sourced
Everything we used is here (ready to run):
https://github.com/meenanukala/terraform-monorepo-to-multirepo-2025
Includes:
- State splitter script (handles nested modules)
- Repo creation template
- Atlantis + OpenTofu config
- Full migration runbook (PDF)
Closing Thought
Monorepos made sense in 2018. In 2025 they are technical debt with interest.
If your Terraform plan takes longer than grabbing coffee, it’s time.
I already did the hard part — just fork and follow the runbook.
— Meena Nukala
Senior DevOps Engineer | UK
GitHub: github.com/meena-nukala-devops
LinkedIn: linkedin.com/in/meena-nukala
(Published 11 December 2025 — clap 50 times if you’ve ever waited 68 minutes for terraform plan)
Top comments (0)