-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdynamodb_stream_lambda.tf
More file actions
74 lines (55 loc) · 1.63 KB
/
Copy pathdynamodb_stream_lambda.tf
File metadata and controls
74 lines (55 loc) · 1.63 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
module "dynamodb_stream_lambda_function" {
source = "terraform-aws-modules/lambda/aws"
version = "5.3.0"
function_name = "${var.environment}-cdc-lambda"
description = "Dynamodb Stream to Custom Eventbridge Lambda function"
handler = "lambda_function.lambda_handler"
runtime = "python3.9"
create_role = true
create_current_version_allowed_triggers = false
memory_size = "128"
# timeout = "60"
#create_async_event_config = true
#maximum_event_age_in_seconds = 100
attach_policies = true
attach_policy_json = true
policy_json = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:GetParameter",
"kms:Decrypt",
"events:PutEvents",
"sqs:*",
"dynamodb:GetRecords",
"dynamodb:GetShardIterator",
"dynamodb:DescribeStream",
"dynamodb:ListStreams",
"sns:*"
],
"Resource": ["*"]
}
]
}
EOF
policies = [
"arn:aws:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole",
"arn:aws:iam::aws:policy/service-role/AWSLambdaDynamoDBExecutionRole",
]
source_path = "./lambda/DynamodbStreamLambda/lambda_function.py"
layers = [
local.lambda_powertools_layer_arn,
]
number_of_policies = 1
environment_variables = {
environment = var.environment
POWERTOOLS_SERVICE_NAME = "DynamodbStreamLambda"
SNS_TOPIC_ARN = module.monitoring_sns_topic.topic_arn
}
tags = {
Name = "${var.environment}-Lambda"
}
}