Move a team from Terraform 0.13 / old provider versions to current versions. How do you avoid breaking things?
AdvancedScenarioMigrations
Answer
Situation read → Big jumps in Terraform and provider versions change state formats and resource schemas. Go step by step and read the upgrade guides.
What I'd do →
- Upgrade Terraform core in steps through 1.x (state format upgrades are one way), running
planat each step to confirm no changes. - Pin providers with
required_providersand commit.terraform.lock.hcl. - Upgrade the AWS provider one major at a time, following the upgrade guide (for example, v4 split
aws_s3_bucketinto separate resources; v5 and v6 removed deprecated arguments). - Refactor with
movedblocks orimportblocks instead of letting Terraform destroy and recreate.
moved {
from = aws_s3_bucket.logs
to = module.logging.aws_s3_bucket.this
}
- Back up state before each step; S3 versioning gives you this.
Why → A clean "no changes" plan after every step is the only proof the upgrade is safe.
Interview tip → Mention moved and import blocks; they replace error-prone terraform state mv commands.
More on Migrations
Migrate an application from EC2 to EKS with zero downtime. Walk me through it.AdvancedMigrate a database from on-prem MySQL to Amazon RDS with minimal downtime. How?AdvancedYou need to move Terraform state from local files to an S3 backend. How?BeginnerMigrate CI from Jenkins to GitHub Actions for 80 repositories. How do you plan it?IntermediateUpgrade an EKS cluster from 1.30 to 1.31 in production. What's your process?IntermediateMove from a monolith to microservices. What's the DevOps side of the migration?Advanced