terraform build_error ai_generated true

错误:计划输出超过最大允许大小 4 MB:计划在保存后已被更改

Error: The plan output exceeds the maximum allowed size of 4 MB: the plan has been changed after it was saved

ID: terraform/terraform-apply-plan-changed

其他格式: JSON · Markdown 中文 · English
90%修复率
85%置信度
1证据数
2024-01-10首次发现

版本兼容性

版本状态引入弃用备注
Terraform v1.6 active
Terraform v1.7 active
Terraform v1.8 active

根因分析

保存的计划文件在创建后被修改或重新生成,导致应用时校验和不匹配。

English

The saved plan file was modified or regenerated after creation, causing a checksum mismatch when applying.

generic

官方文档

https://developer.hashicorp.com/terraform/cli/commands/plan#plan-files

解决方案

  1. Regenerate the plan with the same configuration and apply immediately: 'terraform plan -out=plan.tfplan && terraform apply plan.tfplan'.
  2. Use 'terraform apply' directly without a saved plan file to avoid the size limit issue.

无效尝试

常见但无效的做法:

  1. 95% 失败

    Plan files are binary and checksummed; any manual edit will corrupt the file and cause a different error.

  2. 80% 失败

    Terraform does not support incremental plans; each plan is a full snapshot, and splitting does not reduce total size.

  3. 30% 失败

    While this works, it bypasses the plan review process and may apply unintended changes.