-
Notifications
You must be signed in to change notification settings - Fork 0
/
lambda_fcm_announce.tf
36 lines (28 loc) Β· 1.07 KB
/
lambda_fcm_announce.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
33
34
35
36
data "archive_file" "archive_fcm_announce" {
type = "zip"
source_dir = "${path.module}/lambda_fcm_announce/"
output_path = "lambda_fcm_announce.zip"
}
resource "aws_lambda_function" "lambda_fcm_announce" {
filename = data.archive_file.archive_fcm_announce.output_path
function_name = "lambda_fcm_announce"
role = aws_iam_role.lambda_exec.arn
handler = "lambda_fcm_announce.lambda_handler"
runtime = "python3.12"
timeout = 60
source_code_hash = data.archive_file.archive_fcm_announce.output_base64sha256
layers = [aws_lambda_layer_version.google_api_client_layer.arn]
depends_on = [data.archive_file.archive_fcm_announce]
environment {
variables = {
FCM_SERVER_KEY = var.fcm_server_key
PROJECT_ID = var.fcm_project_id
}
}
}
# Event source mapping for DynamoDB
resource "aws_lambda_event_source_mapping" "ddb_lambda_mapping_announce" {
event_source_arn = aws_dynamodb_table.announcement.stream_arn
function_name = aws_lambda_function.lambda_fcm_announce.arn
starting_position = "LATEST"
}