terraform-aws-modules / terraform-aws-apigateway-v2

Terraform module to create AWS API Gateway v2 (HTTP/WebSocket) 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/apigateway-v2/aws
Apache License 2.0
150 stars 203 forks source link

Wrong example on complete-http? #41

Closed alekc closed 3 years ago

alekc commented 3 years ago

Description

While following example for complete-http, I was deploying my lambda as following:

module "chartmuseum_lambda_function" {
  source = "terraform-aws-modules/lambda/aws"

  function_name  = "chart-museum"
  description    = "Chart museum container"
  create_package = false
  package_type   = "Image"
  image_uri      = docker_registry_image.chart-museum.name
  tags           = var.tags
  publish        = true
  allowed_triggers = {
    AllowExecutionFromAPIGateway = {
      service    = "apigateway"
      source_arn = "${module.chartmuseum_api_gateway.apigatewayv2_api_execution_arn}/*/*/*"
    }
  }
}

As result, it was impossible to execute the lambda due to an error

[09/Jun/2021:12:17:05 +0000] "GET $default HTTP/1.1" 500 35 AqCiOhxcLPEEMIA= The IAM role configured on the integration or API Gateway doesn't have permissions to call the integration. Check the permissions and try again

Only when I changed the source_arn to

 source_arn = "${module.chartmuseum_api_gateway.apigatewayv2_api_execution_arn}/*/*"

it began to work correctly.

Not sure if it's a common case for everyone or not.

antonbabenko commented 3 years ago

This is a bug, you are right. Fixed in 76e7ce2.

github-actions[bot] commented 2 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.