When Terraform Gets Messy: Refactoring, Imports, and State Surgery
S01E06 of Terraform for Application Engineers

S01E06 of Terraform for Application Engineers

S01E05 of Terraform for Application Engineers

S01E04 of Terraform for Application Engineers

S01E03 of Terraform for Application Engineers

Six months into a project, our main.tf was 800 lines long. Every resource — Cloud Run services, Pub/Sub topics, Cloud SQL, Redis, IAM bindings, secrets — lived in one file. Nobody wanted to touch it.

At 11pm on a Tuesday, a Cloud Run service stopped accepting traffic. No deployment had happened. No code had changed. The service was running — Cloud Run showed healthy instances — but requests were t
