-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambdas.tf
More file actions
51 lines (50 loc) · 1.61 KB
/
lambdas.tf
File metadata and controls
51 lines (50 loc) · 1.61 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
module "gitleaks_integration_lambda_function" {
source = "terraform-aws-modules/lambda/aws"
version = "8.0.1"
function_name = local.gitleaks_integration_lambda_function_name
description = "Manage Gitleaks findings in AWS Security Hub"
handler = "lambda_function.lambda_handler"
runtime = var.lambda_runtime
timeout = var.lambda_timeout
cloudwatch_logs_retention_in_days = var.cloudwatch_logs_retention_in_days
source_path = [
"${path.module}/src/lambda_function.py",
"${path.module}/src/common.py",
"${path.module}/src/securityhub_finding.py",
{
pip_requirements = "${path.module}/src/requirements.txt",
}
]
create_current_version_allowed_triggers = false
environment_variables = {
ACCOUNT_ID = local.account_id
}
attach_policy_statements = true
policy_statements = {
"SQS" = {
effect = "Allow"
actions = ["sqs:ReceiveMessage", "sqs:DeleteMessage", "sqs:GetQueueAttributes"]
resources = [module.sqs_queue.queue_arn]
},
"SecurityHub" = {
effect = "Allow"
actions = [
"securityhub:GetFindings",
"securityhub:BatchUpdateFindings",
"securityhub:BatchImportFindings"
]
resources = ["*"]
}
}
event_source_mapping = {
sqs = {
event_source_arn = module.sqs_queue.queue_arn
}
}
allowed_triggers = {
EventBridge = {
principal = "sqs.amazonaws.com"
source_arn = module.sqs_queue.queue_arn
}
}
}