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 Risposta
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
TECNICO DI SUPPORTO
con risposta 9 mesi fa
  • 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".

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande