Hi,
When I deploy AWS API Gateway with Lambda Integration it works as expected without alias or version, I mean “$LATEST” version of Lambda.
But I have to use Lambda Alias for setting Provisioned Concurrency and I am not able to get it working. When I use the script below I am not able to see the API Gateway Trigger and Resource based Policy in AWS console for the Lambda.
resource "aws_lambda_function" "proxy-lambda" {
....
publish = true
}
resource "aws_lambda_alias" "proxy-lambda-alias" {
name = "alias"
function_name = "${aws_lambda_function.proxy-lambda.function_name}"
function_version = "${aws_lambda_function.proxy-lambda.version}"
}
resource "aws_lambda_permission" "apigw" {
statement_id = "AllowAPIGatewayInvoke"
action = "lambda:InvokeFunction"
function_name = "${aws_lambda_function.proxy-lambda.function_name}"
qualifier = "${aws_lambda_alias.proxy-lambda-alias.name}"
principal = "apigateway.amazonaws.com"
source_arn = "{aws_api_gateway_deployment.api-gateway-deployment.execution_arn}/*/*"
}
....
resource "aws_api_gateway_integration" "api-gateway-lambda" {
rest_api_id = "${aws_api_gateway_rest_api.api-gateway.id}"
resource_id = "${aws_api_gateway_method.api-gateway-method.resource_id}"
http_method = "${aws_api_gateway_method.api-gateway-method.http_method}"
integration_http_method = "POST"
type = "AWS_PROXY"
uri = "{aws_lambda_alias.proxy-lambda-alias.invoke_arn}"
}
Could you please help me with this?