{
  "id": "cicd/terraform-plan-stale",
  "signature": "Error: Saved plan is stale. The configuration has changed since the plan was saved.",
  "signature_zh": "错误：保存的计划已过时。自计划保存以来，配置已发生更改。",
  "regex": "Saved plan is stale",
  "domain": "cicd",
  "category": "config_error",
  "subcategory": null,
  "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.",
  "root_cause_type": "generic",
  "root_cause_zh": "Terraform计划是从旧版本的配置文件生成的，但在应用计划之前配置已被修改，导致校验和不匹配。",
  "versions": [
    {
      "version": "Terraform 1.5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "OpenTofu 1.6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Terraform will reject the apply because the plan file's checksum doesn't match the current config; it will fail with the same error",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Plan files are binary and checksummed; manual editing corrupts the file and terraform will refuse to apply it",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Re-run `terraform plan -out=tfplan` to generate a fresh plan, then apply with `terraform apply tfplan`",
      "success_rate": 0.95,
      "how": "Re-run `terraform plan -out=tfplan` to generate a fresh plan, then apply with `terraform apply tfplan`",
      "condition": "",
      "sources": []
    },
    {
      "action": "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`)",
      "success_rate": 0.9,
      "how": "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`)",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "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`)"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.hashicorp.com/terraform/cli/commands/plan#planning-and-applying-in-automation",
  "official_doc_section": null,
  "error_code": "TERRAFORM_STALE_PLAN",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2023-08-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}