How to use multiple query string authorizers with aws_apigatewayv2_authorizer

134 views Asked by At

I´m using a custom lambda authorizer on my API Gateway Websocket, and I'd like to attach another query string authorizer, but I'm facing some errors and I didn't find any example.

The implementation of the authorizer:

resource "aws_apigatewayv2_authorizer" "authorizer" {
  api_id                   = aws_apigatewayv2_api.api_gateway_websocket.id
  authorizer_type          = "REQUEST"
  authorizer_uri           = var.lambda_authorizer_uri
  identity_sources         = ["route.request.querystring.authorization", "route.request.querystring.route"]
  name                     = var.lambda_authorizer_name
  authorizer_credentials_arn = var.authorizer_credentials_arn
}

and my connect:

resource "aws_apigatewayv2_route" "ConnectRoute" {
  api_id         = aws_apigatewayv2_api.api_gateway_websocket.id
  route_key      = "$connect"
  operation_name = "ConnectRoute"
  authorization_type  = "CUSTOM"
  authorizer_id  = aws_apigatewayv2_authorizer.authorizer.id
  depends_on = [
   aws_apigatewayv2_authorizer.authorizer
  ]
}

Is there anyone who have an example of how to use multiple query string authorizers, or any idea of how can I implement this? Thank you so much.

1

There are 1 answers

0
jkg On

We managed to make it work by using the identity_sources of the resource "authorizer" as "route.request.multivaluequerystring.authorization".