Migitate "Throttling: Rate exceeded" terraform 0.11.7 上的错误适用于 AWS

Migitate "Throttling: Rate exceeded" errors on terraform 0.11.7 apply to AWS

有谁知道如何在使用 terraform 0.11.7 时减轻限制

terraform-0.11.7 plan  -out proposed.plan -no-color 

Error: Error refreshing state: 1 error(s) occurred:
* module.ecs_alb.aws_alb_target_group.backend_internal_alb_target_group: 1 error(s) occurred:
* module.ecs_alb.aws_alb_target_group.backend_internal_alb_target_group[5]:
aws_alb_target_group.backend_internal_alb_target_group.5:
Error retrieving Target Group Attributes:
Throttling: Rate exceeded
status code: 400, request id: ...
make: *** [plan] Error 1

我 运行 这些来自 jenkins,所以我用这样的 try catch 循环(我们 运行 terraform 通过 make 和 tf 命令将是计划、应用、输出。我在等待重试间隔 10 秒。我可能会将其延长。

while (retry < retries) {
    try {
        makeError = null
        sh "make ${targets.join(' ')}"
        break
    } catch (Exception ex) {
        fileOperations([fileCopyOperation(excludes: '', flattenFiles: false, includes: '**log',
                renameFiles: false, sourceCaptureExpression: '',
                targetLocation: outputDir, targetNameExpression: '')])
        makeError = ex
        errorHandling.addResult('runMake', "path: ${path}, targets: ${targets}, retry: ${retry} of ${retries} failed with ${makeError}.  retrying")
        sleep time: waitSecs, unit: 'SECONDS'
    } finally {
        retry++
    }
}
if (makeError) {
    throw new Exception("Max retries reached (${retries})", makeError)
}

似乎有几个选项(来自评论者和同事)

  • 将重试逻辑从每次重试等待 N 秒更改为:等待 N 秒,重试,双等待时间,重复(简单且目前有效)
  • 将 -parallelism 从默认值 10 更改为更低的值(操作简单)
  • 将计划的模块从在单个模块中创建如此多的任务组更改为使用多个模块和计划(这成为一个问题,因为从一个计划转移到另一个计划的状态变化将迫使移除娱乐或状态手术来避免这种情况问题)

鉴于第一个似乎在工作,似乎没有必要转移到其他人。如果我后来发现它失败了,那么我将尝试为这个 plan/module 对

调低并行度