[Terraform]API GatewayからLambdaに紐付ける方法

LINEで送る
Pocket

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission#specify-lambda-permissions-for-api-gateway-rest-api

resource "aws_lambda_permission" "hoge" {
  action        = "lambda:InvokeFunction"
  function_name = aws_lambda_function.hoge.function_name
  principal     = "apigateway.amazonaws.com"
  source_arn    = "${aws_api_gateway_rest_api.hoge.execution_arn}/*/${aws_api_gateway_method.post-hoge.http_method}/${aws_api_gateway_resource.hoge.path_part}"
}
aws_api_gateway_integrationでlambdaのuriを指定しても紐付けられないので注意すること。

Was this helpful?

0 / 0

コメントを残す 0

Your email address will not be published. Required fields are marked *