TERRAFORM_STALE_PLAN
cicd
config_error
ai_generated
true
Error: Saved plan is stale. The configuration has changed since the plan was saved.
ID: cicd/terraform-plan-stale
92%Fix Rate
85%Confidence
1Evidence
2023-08-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Terraform 1.5.0 | active | — | — | — |
| OpenTofu 1.6.0 | active | — | — | — |
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.
generic中文
Terraform计划是从旧版本的配置文件生成的,但在应用计划之前配置已被修改,导致校验和不匹配。
Official Documentation
https://developer.hashicorp.com/terraform/cli/commands/plan#planning-and-applying-in-automationWorkarounds
-
95% success Re-run `terraform plan -out=tfplan` to generate a fresh plan, then apply with `terraform apply tfplan`
Re-run `terraform plan -out=tfplan` to generate a fresh plan, then apply with `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`)
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`)
中文步骤
Re-run `terraform plan -out=tfplan` to generate a fresh plan, then apply with `terraform apply tfplan`
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
Common approaches that don't work:
-
100% fail
Terraform will reject the apply because the plan file's checksum doesn't match the current config; it will fail with the same error
-
95% fail
Plan files are binary and checksummed; manual editing corrupts the file and terraform will refuse to apply it