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

Apply job fails: `Failed to read plan from plan file` — `The given plan file was created by Terraform v1.9.5, but this is v1.9.8.`

IntermediateTroubleshootingPartial Applies, Version Mismatches and CI Failures
Answer

Likely causes → Plan and apply jobs used different Terraform versions (different runner images or setup-terraform with latest). Plan files are not portable across versions.

Diagnose → terraform version in both job logs.

Fix → Pin one version in both jobs and re-plan.

Prevent → terraform_version: 1.9.8 in hashicorp/setup-terraform, plus required_version in code, plus a .terraform-version file shared with laptops.

All Terraform questions

More on Partial Applies, Version Mismatches and CI Failures