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 :
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 . As I said it happens sometimes . How could I avoid this 100%?
my autoscaling.tf (since there are many lambdas, it runs for each one)
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.