11locals {
2- api_id = data. tfe_outputs . network . values . api_gw_gateway_api . id
2+ api_id = data. tfe_outputs . network . values . api_gw_gateway_api . id
3+ api_execution_arn = data. tfe_outputs . network . values . api_gw_gateway_api . execution_arn
4+
35 proxy_to_alb_id = data. tfe_outputs . network . values . api_gw_integration_proxy_to_alb . id
46}
57
@@ -14,6 +16,10 @@ resource "aws_apigatewayv2_authorizer" "lambda_authorizer_client" {
1416
1517 authorizer_payload_format_version = " 2.0"
1618 enable_simple_responses = true
19+
20+ authorizer_result_ttl_in_seconds = 0 # For debugging
21+
22+ authorizer_credentials_arn = data. aws_iam_role . lab_role . arn
1723}
1824
1925// ----- Integrations -----
@@ -27,6 +33,8 @@ resource "aws_apigatewayv2_integration" "lambda_identification_nationalid" {
2733 integration_uri = aws_lambda_function. identification_nationalid . invoke_arn
2834
2935 payload_format_version = " 2.0"
36+
37+ credentials_arn = data. aws_iam_role . lab_role . arn
3038}
3139
3240// ----- Routes -----
@@ -58,3 +66,36 @@ resource "aws_apigatewayv2_route" "order_confirmation" {
5866 target = " integrations/${ local . proxy_to_alb_id } "
5967
6068}
69+
70+ // ----- Main -----
71+
72+ # locals {
73+ # api_gw_redeployment_trigger = sha1(join(",", tolist([
74+ # jsonencode(aws_apigatewayv2_authorizer.lambda_authorizer_client),
75+ # jsonencode(aws_apigatewayv2_integration.lambda_identification_nationalid),
76+ # jsonencode(aws_apigatewayv2_route.client_identification),
77+ # jsonencode(aws_apigatewayv2_route.order_checkout_and_listing),
78+ # jsonencode(aws_apigatewayv2_route.order_confirmation),
79+ # ])))
80+ # }
81+
82+ # resource "aws_apigatewayv2_deployment" "deploy_computing_api_gw_resources" {
83+ # api_id = local.api_id
84+ # description = "Deployment for computing-related API Gateway resources (${local.api_gw_redeployment_trigger})"
85+
86+ # triggers = {
87+ # redeployment = local.api_gw_redeployment_trigger
88+ # }
89+
90+ # lifecycle {
91+ # create_before_destroy = true
92+ # }
93+
94+ # depends_on = [
95+ # aws_apigatewayv2_authorizer.lambda_authorizer_client,
96+ # aws_apigatewayv2_integration.lambda_identification_nationalid,
97+ # aws_apigatewayv2_route.client_identification,
98+ # aws_apigatewayv2_route.order_checkout_and_listing,
99+ # aws_apigatewayv2_route.order_confirmation,
100+ # ]
101+ # }
0 commit comments