Terraform State File Migration (Udemy)

TerraformAWSStencilBashPlatform Engineering

Stone steps with green railing

Overview

As Senior Platform Engineer at Udemy Ireland LTD, led the migration of Terraform state management from a single central statefile to individual statefiles per repository across the entire microservice estate.

The Problem

A monolithic central statefile created tight coupling between unrelated services, making changes risky, slow, and a bottleneck for teams. Splitting it was a prerequisite for broader organisational and infrastructure improvements.

Approach

  • Wrote a script to automate the statefile extraction and re-initialisation process per repository, reducing manual error and ensuring consistency.
  • Identified all affected microservices and mapped ownership to the relevant teams and stakeholders.
  • Coordinated with dozens of stakeholders across engineering teams, following up team by team to move at their pace and resolve blockers individually.
  • Used Stencil for repository templating to standardise Terraform configuration structure across the estate.

Outcomes

  • Hundreds of microservices successfully migrated to isolated statefiles.
  • Minimal disruption to ongoing development work throughout the migration.
  • Cleaner, more maintainable repository structure with clear ownership boundaries per service.