How to use multiple query string authorizers with aws_apigatewayv2_authorizer

0

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개 답변
1

Could you suggest what is the error message you are seeing?

I was able to add two query strings successfully in Websocket API authorizer identity sources without any issue on API Gateway console. If possible, could you try adding from console and see if the error persists?

If it works on console as expected and issue is only while deploying with terraform, I would recommend reaching out to terraform support and they should be able suggest the syntax for implementation of the use case.

Feel free to open a premium support case https://docs.aws.amazon.com/awssupport/latest/user/case-management.html and we will be happy to help you troubleshoot the issue.

AWS
지원 엔지니어
답변함 9달 전
  • Hi there, Thank you so much for your time and support. We managed to make it work by using the identity_sources of the resource "authorizer" as "route.request.multivaluequerystring.authorization".

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인