Skip to content

Commit fe816b0

Browse files
committed
feat: lambda archiving via http url module
1 parent c84146c commit fe816b0

File tree

1 file changed

+59
-53
lines changed

1 file changed

+59
-53
lines changed

lambda.tf

Lines changed: 59 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,72 @@
1-
# module "lambda_identification_nationalid" {
2-
# source = "https://github.com/soat-tech-challenge/lambda-identification-nationalid/releases/download/phase-4/artifact-phase-5.zip"
3-
# }
1+
module "lambda_identification_nationalid" {
2+
source = "https://github.com/soat-tech-challenge/lambda-identification-nationalid/releases/download/phase-4/artifact-phase-5.tar.gz"
3+
}
44

5-
# module "lambda_authorizer_client" {
6-
# source = "https://github.com/soat-tech-challenge/lambda-authorizer-client/releases/download/phase-4/artifact-phase-5.zip"
7-
# }
5+
module "lambda_authorizer_client" {
6+
source = "https://github.com/soat-tech-challenge/lambda-authorizer-client/releases/download/phase-4/artifact-phase-5.tar.gz"
7+
}
88

9-
# data "archive_file" "lambda1" {
10-
# type = "zip"
11-
# source_file = "${path.module}/init.tpl"
12-
# output_path = "${path.module}/files/init.zip"
13-
# }
9+
data "archive_file" "lambda_identification_nationalid" {
10+
type = "zip"
11+
source_dir = "${path.module}/.terraform/modules/lambda_identification_nationalid"
12+
output_path = "${path.module}/lambda1.zip"
13+
}
1414

15-
# resource "aws_lambda_function" "identification_nationalid" {
16-
# filename = terraform_data.download_archive_lambda1.output
17-
# function_name = "SOAT_TC_Lambda_Identification_NationalID"
18-
# description = "Generates Client JWT using National ID"
19-
# role = data.aws_iam_role.lab_role.arn
20-
# handler = "index.handler"
15+
data "archive_file" "lambda_authorizer_client" {
16+
type = "zip"
17+
source_dir = "${path.module}/.terraform/modules/lambda_authorizer_client"
18+
output_path = "${path.module}/lambda2.zip"
19+
}
2120

22-
# source_code_hash = filebase64sha256(terraform_data.download_archive_lambda1.output)
21+
resource "aws_lambda_function" "identification_nationalid" {
22+
filename = data.archive_file.lambda_identification_nationalid.output_path
23+
function_name = "SOAT_TC_Lambda_Identification_NationalID"
24+
description = "Generates Client JWT using National ID"
25+
role = data.aws_iam_role.lab_role.arn
26+
handler = "index.handler"
2327

24-
# runtime = "nodejs20.x"
28+
source_code_hash = data.archive_file.lambda_identification_nationalid.output_base64sha256
2529

26-
# environment {
27-
# variables = {
28-
# BACKEND_URL = local.alb_url
29-
# JWT_PRIVATE_KEY = var.client_jwt_private_key
30-
# }
31-
# }
30+
runtime = "nodejs20.x"
3231

33-
# vpc_config {
34-
# subnet_ids = local.private_subnets_ids
35-
# security_group_ids = [local.default_sg_id]
36-
# }
32+
environment {
33+
variables = {
34+
BACKEND_URL = local.alb_url
35+
JWT_PRIVATE_KEY = var.client_jwt_private_key
36+
}
37+
}
3738

38-
# logging_config {
39-
# log_format = "Text"
40-
# log_group = aws_cloudwatch_log_group.lambda_identification_nationalid.name
41-
# }
42-
# }
39+
vpc_config {
40+
subnet_ids = local.private_subnets_ids
41+
security_group_ids = [local.default_sg_id]
42+
}
4343

44-
# resource "aws_lambda_function" "authorizer_client" {
45-
# filename = terraform_data.download_archive_lambda2.output
46-
# function_name = "SOAT_TC_Lambda_Authorizer_Client"
47-
# description = "Authorizer Lambda for Client requests"
48-
# role = data.aws_iam_role.lab_role.arn
49-
# handler = "index.handler"
44+
logging_config {
45+
log_format = "Text"
46+
log_group = aws_cloudwatch_log_group.lambda_identification_nationalid.name
47+
}
48+
}
5049

51-
# source_code_hash = filebase64sha256(terraform_data.download_archive_lambda2.output)
50+
resource "aws_lambda_function" "authorizer_client" {
51+
filename = data.archive_file.lambda_authorizer_client.output_path
52+
function_name = "SOAT_TC_Lambda_Authorizer_Client"
53+
description = "Authorizer Lambda for Client requests"
54+
role = data.aws_iam_role.lab_role.arn
55+
handler = "index.handler"
5256

53-
# runtime = "nodejs20.x"
57+
source_code_hash = data.archive_file.lambda_authorizer_client.output_base64sha256
5458

55-
# environment {
56-
# variables = {
57-
# BACKEND_URL = local.alb_url
58-
# JWT_PRIVATE_KEY = var.client_jwt_private_key
59-
# }
60-
# }
59+
runtime = "nodejs20.x"
6160

62-
# logging_config {
63-
# log_format = "Text"
64-
# log_group = aws_cloudwatch_log_group.lambda_authorizer_client.name
65-
# }
66-
# }
61+
environment {
62+
variables = {
63+
BACKEND_URL = local.alb_url
64+
JWT_PRIVATE_KEY = var.client_jwt_private_key
65+
}
66+
}
67+
68+
logging_config {
69+
log_format = "Text"
70+
log_group = aws_cloudwatch_log_group.lambda_authorizer_client.name
71+
}
72+
}

0 commit comments

Comments
 (0)