Interview Prep/Terraform/Refactoring, Migration and Drift

How do you diagnose a perpetual diff?

AdvancedProductionRefactoring, Migration and Drift
Answer

Run terraform plan twice and read the diff closely. Common causes: JSON documents with different key ordering or whitespace (use jsonencode), lists vs sets with order differences, provider-normalised values (lowercased names, trailing dots in DNS, full ARNs), tags added by AWS or other tools and computed defaults. Use TF_LOG=DEBUG to see what the API returns, compare terraform state show against config and fix the config to the canonical form.

All Terraform questions Roadmap: Terraform in production

More on Refactoring, Migration and Drift