Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit b78ccde

Browse files
feat(webhook): Enable authorizer assignment to webhook (#4000)
We want to add a lambda authenticator to webhook API endpoint to restrict requests by source IP address. To achieve this, the following two options are possible: 1. add attributes to pass authorizer resource information to this module, 2. or simply ignores changes related to authorizer of `aws_apigatewayv2_route` resource, However, 1. requires all informations to create `aws_apigatewayv2_authorizer` and `aws_lambda_permission`, this is little bit need consideration. Option 2. is, of cource, needs resouce update by hand, however, the very simple to achieve by ignoring attribute changes. This PR aims to implement option 2. --------- Co-authored-by: Niek Palm <[email protected]>
1 parent 221958b commit b78ccde

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: modules/webhook/main.tf

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ resource "aws_apigatewayv2_route" "webhook" {
1414
api_id = aws_apigatewayv2_api.webhook.id
1515
route_key = "POST /${local.webhook_endpoint}"
1616
target = "integrations/${aws_apigatewayv2_integration.webhook.id}"
17+
18+
lifecycle {
19+
ignore_changes = [
20+
# Ignore authorization related attributes to enable authenticator assignment to API route.
21+
# NOTE: We consider the ignores as a system intenral. Future changes will not trigger a breakig change.
22+
authorizer_id,
23+
authorization_type,
24+
authorization_scopes,
25+
]
26+
}
1727
}
1828

1929
resource "aws_apigatewayv2_stage" "webhook" {

0 commit comments

Comments
 (0)