ProvisionedThroughputExceededException terraform resource_error ai_generated true

错误:获取状态锁失败:ConditionalCheckFailedException:条件请求失败:ProvisionedThroughputExceededException:速率超限

Error: Error acquiring the state lock: ConditionalCheckFailedException: The conditional request failed: ProvisionedThroughputExceededException: Rate exceeded

ID: terraform/state-lock-dynamodb-throttling

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

版本兼容性

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

根因分析

用于状态锁定的 DynamoDB 表因请求速率过高而受到限流,超出了预置的读写容量。

English

DynamoDB table used for state locking is experiencing throttling due to high request rates, exceeding its provisioned read/write capacity.

generic

官方文档

https://developer.hashicorp.com/terraform/language/settings/backends/s3#dynamodb-table-configuration

解决方案

  1. 增加 DynamoDB 表的预置读写容量单元以处理峰值负载。如果工作负载不可预测,切换到按需容量模式。
  2. 通过将 terraform 命令包装在带有指数退避的 bash 脚本中,实现客户端重试逻辑。
  3. 在高峰时段减少 terraform apply/plan 操作的频率,或错开多个 CI/CD 管道以避免并发锁尝试。

无效尝试

常见但无效的做法:

  1. 90% 失败

    The lock acquisition failed due to throttling, not because the lock is held. Force-unlock doesn't address the throughput issue.

  2. 80% 失败

    Deleting the table removes all state lock items but also any existing locks. Recreating with default settings still has low throughput.

  3. 95% 失败

    Terraform's retry mechanism is for provider operations, not for state lock acquisition. The lock mechanism is internal and not configurable.