1
1
locals {
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
+
3
5
proxy_to_alb_id = data. tfe_outputs . network . values . api_gw_integration_proxy_to_alb . id
4
6
}
5
7
@@ -14,6 +16,10 @@ resource "aws_apigatewayv2_authorizer" "lambda_authorizer_client" {
14
16
15
17
authorizer_payload_format_version = " 2.0"
16
18
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
17
23
}
18
24
19
25
// ----- Integrations -----
@@ -27,6 +33,8 @@ resource "aws_apigatewayv2_integration" "lambda_identification_nationalid" {
27
33
integration_uri = aws_lambda_function. identification_nationalid . invoke_arn
28
34
29
35
payload_format_version = " 2.0"
36
+
37
+ credentials_arn = data. aws_iam_role . lab_role . arn
30
38
}
31
39
32
40
// ----- Routes -----
@@ -58,3 +66,36 @@ resource "aws_apigatewayv2_route" "order_confirmation" {
58
66
target = " integrations/${ local . proxy_to_alb_id } "
59
67
60
68
}
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