fix(apigatewayv2): include authorizerId on Route management API responses (#887)

`Route` already stores `authorizerId` (set by `createRoute`/`updateRoute` and
read at runtime by `WebSocketHandler` and `ApiGatewayExecuteController` for JWT
and Lambda authorizer invocation), but `ApiGatewayController.toV2RouteNode`
omitted it from the JSON returned by `POST/PATCH/GET /v2/apis/{apiId}/routes`.
Get-route therefore always reported `authorizerId = null`, which causes IaC
tools like Terraform's `aws_apigatewayv2_route` to see drift on every plan
even when the route is configured correctly.

Adds the missing emit alongside the other optional Route fields and a focused
regression test (`RouteAuthorizerIdResponseTest`) covering create/get/list and
the PATCH update path.
This commit is contained in:
Yoshiyuki Ohta authored and GitHub committed 2026-05-17 23:36:02 -05:00
1 parent ffe7d6ddc9
commit becbbea5f9
2 files changed
+123

No files matched your search

@@ -1567,6 +1567,7 @@ public class ApiGatewayController {
node.put("routeId", r.getRouteId());
node.put("routeKey", r.getRouteKey());
node.put("authorizationType", r.getAuthorizationType());
if (r.getAuthorizerId() != null) node.put("authorizerId", r.getAuthorizerId());
if (r.getTarget() != null) node.put("target", r.getTarget());
if (r.getRouteResponseSelectionExpression() != null) node.put("routeResponseSelectionExpression", r.getRouteResponseSelectionExpression());
return node;