Introduction Configuration drift between source and target environments during migration causes applications to fail at runtime. Environment variables, config files, and secrets that differ between environments are a common source of migration failures.

Symptoms - Application starts but behaves incorrectly - Error: "Connection refused" to database or external service - Missing environment variables causing null pointer exceptions - Feature flags behaving differently - Application logging wrong environment name

Common Causes - Environment variables not migrated - Config file paths different in new environment - Secrets not transferred to new secret manager - Database connection strings pointing to old database - Third-party API keys not updated for new environment

Step-by-Step Fix 1. **Audit configuration differences': ```bash # Compare environment variables diff <(env | sort) <(ssh new-server "env" | sort) # Compare config files diff /etc/app/config.yml new-server:/etc/app/config.yml ```

  1. 1.**Use configuration management tools':
  2. 2.```bash
  3. 3.# Apply configuration via Ansible/Terraform
  4. 4.ansible-playbook configure-app.yml -i new-inventory
  5. 5.terraform apply -target=module.app_config
  6. 6.`
  7. 7.**Migrate secrets':
  8. 8.```bash
  9. 9.# Export from old secret manager
  10. 10.aws secretsmanager get-secret-value --secret-id my-secret --query SecretString
  11. 11.# Import to new secret manager
  12. 12.aws secretsmanager create-secret --name my-secret --secret-string "value"
  13. 13.`

Prevention - Document all configuration before migration - Use infrastructure as code for all configuration - Maintain environment parity with automated validation - Use configuration management tools (Ansible, Chef) - Test application in staging environment matching production