Environment Drift Fix (Staging Finally Matches Production)

Dev/staging/prod were different, so bugs appeared only after release

Timeline: 3–5 weeksResult: More predictable releases with reproducible environments and fewer surprises
TerraformCI/CDDockerAWSSecrets Management

Context

The team had environments, but they weren't trustworthy. Staging behaved differently than production, and production had manual changes nobody tracked. That meant "works on staging" didn't mean anything.

Problem

  • Staging didn't represent production
  • Production had untracked manual tweaks
  • Secrets and env vars were inconsistent
  • Releases needed last-minute hotfixes

Constraints

  • Fix drift without stopping feature delivery
  • Keep secrets safe
  • Make it maintainable for the team long-term

Solution

  • Audited what actually exists in each environment
  • Codified infra so environments share the same base (with small env-specific settings)
  • Standardized config and secret handling through the pipeline
  • Ensured the same build artifact moves through dev → staging → prod

Results

  • Fewer "only in prod" bugs
  • More confidence in releases
  • Easier onboarding because setup became reproducible

Stack

Terraform, CI/CD, Docker artifacts, AWS, secrets management practices