terraform
encoding_error
ai_generated
true
错误:计划输出超过最大允许大小 4 MB;请尝试减少资源数量或使用二进制计划文件
Error: The plan output exceeds the maximum allowed size of 4 MB; try reducing the number of resources or using a binary plan file
ID: terraform/plan-output-encoding-error
80%修复率
86%置信度
1证据数
2024-02-01首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Terraform v1.6.0 | active | — | — | — |
| Terraform v1.7.0 | active | — | — | — |
| Terraform v1.8.0 | active | — | — | — |
根因分析
由于资源数量过多或属性值过大,JSON 格式的计划输出过大(超过 4 MB)。
English
The JSON-formatted plan output is too large (over 4 MB) due to an excessive number of resources or large attribute values.
官方文档
https://developer.hashicorp.com/terraform/cli/commands/plan#plan-output-size解决方案
-
使用 'terraform plan -out=plan.tfplan' 生成二进制计划文件而不是 JSON 输出,没有大小限制。
-
如果需要 JSON 输出,使用 'terraform plan -target=资源类型.名称' 减少计划范围,专注于特定资源。
-
使用 'terraform plan -compact-warnings' 和 'terraform plan -no-color' 减少输出冗余。
无效尝试
常见但无效的做法:
-
80% 失败
The JSON output is what exceeds the limit, not the binary plan.
-
70% 失败
Complex dependencies between resources may cause state fragmentation.
-
60% 失败
Apply may still fail or produce unexpected results without a plan.