# Error: Saved plan is stale. The configuration has changed since the plan was saved.

- **ID:** `cicd/terraform-plan-stale`
- **Domain:** cicd
- **Category:** config_error
- **Error Code:** `TERRAFORM_STALE_PLAN`
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

Terraform plan was generated from an older version of the configuration files, but the configuration was modified before the plan could be applied, causing a checksum mismatch.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Terraform 1.5.0 | active | — | — |
| OpenTofu 1.6.0 | active | — | — |

## Workarounds

1. **Re-run `terraform plan -out=tfplan` to generate a fresh plan, then apply with `terraform apply tfplan`** (95% success)
   ```
   Re-run `terraform plan -out=tfplan` to generate a fresh plan, then apply with `terraform apply tfplan`
   ```
2. **In CI/CD pipelines, run plan and apply in the same job without intermediate steps that modify config files (e.g., use a single workflow step: `terraform plan -out=tfplan && terraform apply tfplan`)** (90% success)
   ```
   In CI/CD pipelines, run plan and apply in the same job without intermediate steps that modify config files (e.g., use a single workflow step: `terraform plan -out=tfplan && terraform apply tfplan`)
   ```

## Dead Ends

- **** — Terraform will reject the apply because the plan file's checksum doesn't match the current config; it will fail with the same error (100% fail)
- **** — Plan files are binary and checksummed; manual editing corrupts the file and terraform will refuse to apply it (95% fail)
