Reputation: 127
This feeds off of question: Issue with Creating Application Auto Scaling with AWS Lambda using Terraform
I put a Lambda Alias in my terraform that I'm going to use in my Provisioned Concurrency Config. I get the following error during the aws_lambda_provisioned_concurrency_config resource creation:
Error: error getting Lambda Provisioned Concurrency Config (arn:aws:lambda:us-east-1:<AWS-ACCOUNT-#>:function:foo:PC): ValidationException: status code: 400, request id: 82c5e589-d455-4d53-abea-bac8e5b5a2ea
My terraform is below:
resource "aws_lambda_alias" "foo_pc" {
name = "PC"
description = "foo PC Alias"
function_name = aws_lambda_function.foo.arn
function_version = aws_lambda_function.foo.version
}
resource "aws_lambda_provisioned_concurrency_config" "foo_provisioned_concurrency" {
function_name = aws_lambda_alias.foo_pc.function_name
provisioned_concurrent_executions = var.PCInit
qualifier = aws_lambda_alias.foo_pc.name
}
I want the alias to point to the latest deployment of the lambda. Can I not use in my aws_lambda_function.foo.version in my lambda alias?
Upvotes: 3
Views: 11641
Reputation: 16805
From the AWS docs, in case Lambda provisioned concurrency auto-scaling:
Lambda provisioned concurrency - The resource type is function and the unique identifier is the function name with a function version or alias name suffix that is not
$LATEST
. Example:function:my-function:prod
orfunction:my-function:1
.
In case of an alias, the resource id should look something like this:
resource_id = "function:${aws_lambda_function.foo.name}:${aws_lambda_alias.foo_pc.name}"
Update for the error message:
There is an open issue reported for the provider in GitHub: https://github.com/hashicorp/terraform-provider-aws/issues/12923
Upvotes: 2