Skip to content

Commit 0e544cd

Browse files
authored
gateway fixes (#55)
1 parent 69cba81 commit 0e544cd

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1515

1616
### Removed
1717

18+
## [2.0.3] - 2026-01-27
19+
20+
### Fixed
21+
22+
- Correctly point API Gateway to the published lambda version so that features like provisioned concurrency work as expected, and trigger deployment of the gateway when any changes to dependencies occur
1823

1924
## [2.0.2] - 2026-01-26
2025

api.tf

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ resource "aws_api_gateway_integration" "stac_server_api_gateway_root_method_inte
189189
resource_id = aws_api_gateway_rest_api.stac_server_api_gateway.root_resource_id
190190
http_method = aws_api_gateway_method.stac_server_api_gateway_root_method.http_method
191191
type = "AWS_PROXY"
192-
uri = "arn:aws:apigateway:${data.aws_region.current.region}:lambda:path/2015-03-31/functions/${aws_lambda_function.stac_server_api.arn}/invocations"
192+
uri = "arn:aws:apigateway:${data.aws_region.current.region}:lambda:path/2015-03-31/functions/${aws_lambda_function.stac_server_api.qualified_arn}/invocations"
193193
integration_http_method = "POST"
194194
}
195195

@@ -287,7 +287,7 @@ resource "aws_api_gateway_integration" "stac_server_api_gateway_proxy_resource_m
287287
resource_id = aws_api_gateway_resource.stac_server_api_gateway_proxy_resource.id
288288
http_method = aws_api_gateway_method.stac_server_api_gateway_proxy_resource_method.http_method
289289
type = "AWS_PROXY"
290-
uri = "arn:aws:apigateway:${data.aws_region.current.region}:lambda:path/2015-03-31/functions/${aws_lambda_function.stac_server_api.arn}/invocations"
290+
uri = "arn:aws:apigateway:${data.aws_region.current.region}:lambda:path/2015-03-31/functions/${aws_lambda_function.stac_server_api.qualified_arn}/invocations"
291291
integration_http_method = "POST"
292292
}
293293

@@ -305,6 +305,24 @@ resource "aws_api_gateway_deployment" "stac_server_api_gateway" {
305305

306306
rest_api_id = aws_api_gateway_rest_api.stac_server_api_gateway.id
307307

308+
triggers = {
309+
redeployment = sha1(jsonencode([
310+
aws_api_gateway_resource.stac_server_api_gateway_proxy_resource,
311+
aws_api_gateway_method.stac_server_api_gateway_root_method,
312+
aws_api_gateway_integration.stac_server_api_gateway_root_method_integration,
313+
aws_api_gateway_method.stac_server_api_gateway_proxy_resource_method,
314+
aws_api_gateway_integration.stac_server_api_gateway_proxy_resource_method_integration,
315+
aws_api_gateway_method.stac_root_options_method,
316+
aws_api_gateway_method_response.stac_root_options_200,
317+
aws_api_gateway_integration.stac_root_options_integration,
318+
aws_api_gateway_integration_response.stac_root_options_integration_response,
319+
aws_api_gateway_method.stac_options_method,
320+
aws_api_gateway_method_response.stac_options_200,
321+
aws_api_gateway_integration.stac_options_integration,
322+
aws_api_gateway_integration_response.stac_options_integration_response,
323+
]))
324+
}
325+
308326
lifecycle {
309327
create_before_destroy = true
310328
}
@@ -333,6 +351,7 @@ resource "aws_lambda_permission" "stac_server_api_gateway_lambda_permission_root
333351
statement_id = "AllowExecutionFromAPIGatewayRootResource"
334352
action = "lambda:InvokeFunction"
335353
function_name = aws_lambda_function.stac_server_api.arn
354+
qualifier = aws_lambda_function.stac_server_api.version
336355
principal = "apigateway.amazonaws.com"
337356

338357
source_arn = "arn:aws:execute-api:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:${aws_api_gateway_rest_api.stac_server_api_gateway.id}/*/*"
@@ -342,6 +361,7 @@ resource "aws_lambda_permission" "stac_server_api_gateway_lambda_permission_prox
342361
statement_id = "AllowExecutionFromAPIGatewayProxyResource"
343362
action = "lambda:InvokeFunction"
344363
function_name = aws_lambda_function.stac_server_api.arn
364+
qualifier = aws_lambda_function.stac_server_api.version
345365
principal = "apigateway.amazonaws.com"
346366

347367
source_arn = "arn:aws:execute-api:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:${aws_api_gateway_rest_api.stac_server_api_gateway.id}/*/*${aws_api_gateway_resource.stac_server_api_gateway_proxy_resource.path}"

0 commit comments

Comments
 (0)