【发布时间】:2021-06-07 15:33:00
【问题描述】:
使用 Terraform,我有一个 AWS HTTP API 网关的配置,如下所示:
resource "aws_apigatewayv2_authorizer" "authorizer" {
api_id = module.api_gateway.this_apigatewayv2_api_id
name = "authorizer"
authorizer_payload_format_version = "2.0"
enable_simple_responses = true
authorizer_result_ttl_in_seconds = var.authorizer_result_ttl_in_seconds
authorizer_type = "REQUEST"
identity_sources = ["$request.header.Authorization"]
# Problem is below:
authorizer_uri = module.auth-authorizer-lambda.this_lambda_function_invoke_arn
}
当我使用this_lambda_function_invoke_arn 时,这可以正常工作,但不会调用 Lambda 的并发配置版本(因此 Lambda 可以工作,例如 4s)。通常可以通过this_lambda_function_qualified_arn 引用这样的版本,但使用它会导致错误:
Error: error updating API Gateway v2 authorizer: BadRequestException: Invalid Authorizer URI:
arn:aws:lambda:eu-west-1:<account-id>:function:authorizer:5.
Authorizer URI should be a valid API Gateway ARN that represents a Lambda function invocation.
如何配置 API 网关以使用特定版本的 Authorizer lambda?
【问题讨论】:
标签: amazon-web-services aws-lambda terraform terraform-provider-aws