Перейти к содержимому

Monolith begone! How to split a Terraform state with demonolith

Karl Schriek

0:00 / 0:00

Monolith begone! How to split a Terraform state with demonolith

302 просмотра · 2 нед. назад
Karl Schriek
27 подписчиков
302 просмотра · 2 нед. назад
You know you should split your Terraform monolith. Slow plans, a blast radius that covers everything, teams stepping on each other. So why do you keep putting it off? Because the split is ten mechanical steps, and the second half runs against real infrastructure — one mistyped state address and a resource gets destroyed and recreated in production. This video shows how to do it without that risk. First the concept: what actually makes splitting a monolith hard, and the one thing the monolith quietly did for you — it kept the entire dependency graph in a single state and walked it for you on every plan. Split it apart and that graph moves outside Terraform's reach; nothing walks it for you anymore. Then Demonolith: a CLI that runs the whole ten-step procedure and checks its own work. You annotate the monolith instead of writing a migration script, and it splits the code (reversible with git) and migrates the state (the part that touches real backends) as two separate command families, proving the split changes nothing before it pushes anything. I run the whole thing end-to-end against a runnable sample — a deliberately messy monolith with remote state — locally, with no cloud account. Finally, adoption: once the monolith is split you have independent roots whose dependencies now live outside any single state. Demonolith generates a Snap CD bootstrap straight from the split, and Snap CD takes over the ordering and value-passing the monolith used to do implicitly. Runs on OpenTofu. Demonolith and the sample are both public and free to use. ▸ Why split at all? "No More Terraform Monoliths!" —    • No More Terraform Monoliths! Introducing S...   Snap CD ▸ Source — https://github.com/schrieksoft/snapcd ▸ Home — https://snapcd.io ▸ Docs — https://docs.snapcd.io ▸ Quickstart — https://docs.snapcd.io/quickstart/ ▸ Provider — https://registry.terraform.io/provide... Demonolith ▸ Demonolith — https://github.com/schrieksoft/demono... ▸ Sample — https://github.com/snapcd-samples/sam... Chapters: 00:00 Why splitting a monolith is hard 01:18 How do you actually split it? 01:51 The manual steps, quickfire 03:34 Meet demonolith 04:10 demonolith refactor 05:31 demonolith migrate 07:18 Demo — build the monolith 10:38 Demo — refactor + migrate 17:24 Demo — Snap CD adoption 18:14 Wrap-up