简体   繁体   English

Terraform:ConcurrentUpdateException:您已有对 Auto Scaling 资源的待定更新

[英]Terraform: ConcurrentUpdateException: You already have a pending update to an Auto Scaling resource

I'm trying to configure Application Auto Scaling to manage provisioned concurrency in a lambda function via Terraform. Sometimes I get the following exception when running apply :我正在尝试配置 Application Auto Scaling 以通过 Terraform 管理 lambda function 中的预配置并发。有时我在运行apply时遇到以下异常:

Error creating application autoscaling target: ConcurrentUpdateException: You already have a pending update to an Auto Scaling resource.
    status code: 400, request id: dd93d5d3-314c-11ea-aeb2-d9246c0fa0b9

  on autoscaling.tf line 1, in resource "aws_appautoscaling_target" "autoscaling-lambda-target":
   1: resource "aws_appautoscaling_target" "autoscaling-lambda-target" {

I know this error occurs if you request an update to an Application Auto Scaling resource that already has a pending update .我知道如果您请求更新已具有挂起更新的 Application Auto Scaling 资源,则会发生此错误。 As I said it happens sometimes .正如我所说,它有时会发生。 How could I avoid this 100%?我怎样才能 100% 避免这种情况?

my autoscaling.tf (since there are many lambdas, it runs for each one)我的autoscaling.tf (因为有很多 lambda,它会为每个运行)

resource "aws_appautoscaling_target" "lambda-target" {

  depends_on = [
    aws_lambda_alias.alias-qa
  ]
  for_each = aws_lambda_function.lambda-function

  max_capacity = local.lambda_functions[each.key].max 
  min_capacity = local.lambda_functions[each.key].min 
  resource_id = "function:${each.value.function_name}:${var.stage}"
  scalable_dimension = "lambda:function:ProvisionedConcurrency"
  service_namespace = "lambda"
}

You could try setting -parallelism=1 so it does not try to do multiple operations at the same time, this will slow down the overall deployment though.您可以尝试设置-parallelism=1这样它就不会尝试同时执行多个操作,但这会减慢整体部署速度。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果您只有 1 个实例,则 Elastic Beanstalk NetworkOut 自动缩放 - Elastic Beanstalk NetworkOut auto scaling if you have only 1 instance 获取 Terraform 资源已存在错误,资源刚刚由 Terraform 创建 - Getting Terraform resource already exists error with resource just created by Terraform 运行 terraform 时出现问题:错误:更新 Auto Scaling 组 XXX:拒绝访问:您无权使用启动模板:XXX - Issue when running terraform: Error: updating Auto Scaling Group XXX: AccessDenied: You are not authorized to use launch template: XXX 有关如何自动检查 AWS 资源的较新版本并更新它的建议。 使用的 IAC 是 Terraform - Suggestions on how to have an automated job check for newer versions of an AWS resource and update it. The IAC used is Terraform 我可以将变量传递给使用 terraform 和 user_data 创建的 AWS EC2 实例吗? 或者更新一个已经创建的资源 - Can i pass variables to AWS EC2 instances created with terraform and user_data? Or update an already created resource Terraform 无法在已存在的组中创建资源 - Terraform can't create resource in group already exist 是什么导致 Terraform “忘记”它已经在管理它创建的资源? - What could cause Terraform to "forget" that it's already managing a resource it created? AWS DynamoDB 自动缩放。 规定的读取范围。 如何在 Terraform 脚本中设置范围? - AWS DynamoDB Auto Scaling. Provisioned range for reads. How to setup the range in Terraform script? 通过 Terraform 在 EC2 Auto Scaling Group Target Tracking 中指定多个指标 - Specifying multiple metrics in EC2 Auto Scaling Group Target Tracking thru Terraform 您已经拥有一个名称为 package 的应用程序 - you already have an app with that package name
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM