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

The apply job uses the plan artifact from the plan job but fails with `Error: Inconsistent dependency lock file` or missing provider plugins.

IntermediateTroubleshootingPartial Applies, Version Mismatches and CI Failures
Answer

Likely causes → Only tfplan was passed between jobs; the apply runner has a fresh checkout with no .terraform, or a different commit checked out.

Diagnose → Check the apply job runs terraform init and checks out the same commit SHA as the plan job.

Fix → In the apply job: checkout the same SHA, terraform init -input=false -lockfile=readonly with the same backend config, then terraform apply tfplan.

Prevent → Treat plan artifacts as tied to commit + Terraform version + lock file; store them with the SHA in the name.

All Terraform questions

More on Partial Applies, Version Mismatches and CI Failures