-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtcgcsv_lambda_url_expander.tf
32 lines (27 loc) · 1.28 KB
/
tcgcsv_lambda_url_expander.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
resource "aws_lambda_function" "tcgcsv_lambda_url_expander" {
# If the file is not in the current working directory you will need to include a
# path.module in the filename.
filename = "lambda_url_expander/bundle.zip"
function_name = "tcgcsv_url_expander"
role = aws_iam_role.lambda-executor-role.arn
handler = "main.lambda_handler"
# The filebase64sha256() function is available in Terraform 0.11.12 and later
# For Terraform 0.11.11 and earlier, use the base64sha256() function and the file() function:
# source_code_hash = "${base64sha256(file("lambda_function_payload.zip"))}"
source_code_hash = filebase64sha256("lambda_url_expander/bundle.zip")
runtime = "python3.11"
environment {
variables = {
TCGCSV_IMPACT_AFFILIATE_BASE_URL = "https://partner.tcgplayer.com/tcgcsv"
}
}
}
# Allow lambda to talk to API-Gateway
resource "aws_lambda_permission" "apigw" {
statement_id = "AllowAPIGatewayInvoke"
action = "lambda:InvokeFunction"
function_name = "${aws_lambda_function.tcgcsv_lambda_url_expander.function_name}"
principal = "apigateway.amazonaws.com"
# The /*/* portion grants access from any method on any resource within the API Gateway "REST API".
source_arn = "${aws_apigatewayv2_api.tcgcsv_api.execution_arn}/*/*"
}