resource "aws_apigatewayv2_api" "gateway" { name = "game_server_api" protocol_type = "HTTP" tags = local.tags } resource "aws_apigatewayv2_authorizer" "auth" { api_id = aws_apigatewayv2_api.gateway.id authorizer_type = "JWT" identity_sources = ["$request.header.Authorization"] name = "cognito-authorizer" jwt_configuration { audience = [aws_cognito_user_pool_client.client.id] issuer = "https://${aws_cognito_user_pool.pool.endpoint}" } } resource "aws_apigatewayv2_stage" "test" { api_id = aws_apigatewayv2_api.gateway.id name = "test" auto_deploy = true default_route_settings { #logging_level = "INFO" detailed_metrics_enabled = true throttling_burst_limit = 100 throttling_rate_limit = 100 } access_log_settings { destination_arn = aws_cloudwatch_log_group.test.arn format = "{ \"requestId\":\"$context.requestId\", \"extendedRequestId\":\"$context.extendedRequestId\", \"ip\": \"$context.identity.sourceIp\", \"caller\":\"$context.identity.caller\", \"user\":\"$context.identity.user\", \"requestTime\":\"$context.requestTime\", \"httpMethod\":\"$context.httpMethod\", \"resourcePath\":\"$context.resourcePath\", \"status\":\"$context.status\", \"protocol\":\"$context.protocol\", \"responseLength\":\"$context.responseLength\" }" } } resource "aws_api_gateway_account" "logging" { cloudwatch_role_arn = aws_iam_role.cloudwatch.arn } resource "aws_cloudwatch_log_group" "test" { name = "/aws/apigateway/game_server/test" tags = local.tags }