terraform runtime_error ai_generated partial

错误:计划输出超过最大允许大小 4 MB

Error: The plan output exceeds the maximum allowed size of 4 MB

ID: terraform/plan-output-too-large

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

版本兼容性

版本状态引入弃用备注
1.6.0 active
1.7.0 active
1.8.0 active

根因分析

由于资源过多或状态数据过大,Terraform 计划文件超过 4 MB 的计划序列化限制。

English

The Terraform plan file is too large due to many resources or large state data, exceeding the 4 MB limit for plan serialization.

generic

官方文档

https://developer.hashicorp.com/terraform/cli/commands/plan

解决方案

  1. 通过使用 Terraform 模块或拆分为单独的配置来减少单个计划中的资源数量。例如,将大型 VPC 设置拆分为较小的模块。
  2. 使用 'terraform plan -out=plan.tfplan' 然后 'terraform show plan.tfplan' 查看计划,而不是依赖完整输出。

无效尝试

常见但无效的做法:

  1. 95% 失败

    Increasing the timeout or retrying the plan does not reduce the plan size.

  2. 75% 失败

    Splitting the configuration into multiple workspaces without reducing resource count still results in large plans.