Interview Prep/Terraform/Partial Applies, Version Mismatches and CI Failures

`Error: Resource instance managed by newer provider version` — `The current state of aws_instance.web was created by a newer provider version than is currently selected.`

IntermediateTroubleshootingPartial Applies, Version Mismatches and CI Failures
Answer

Likely causes → Someone applied with a newer AWS provider (unlocked or an older lock file in your branch). State now has a newer schema version.

Diagnose → Compare .terraform.lock.hcl on your branch with main.

Fix → Rebase on main and terraform init, or terraform init -upgrade to at least that provider version.

Prevent → Commit the lock file; CI uses -lockfile=readonly; Renovate manages provider bumps.

All Terraform questions

More on Partial Applies, Version Mismatches and CI Failures