-
Notifications
You must be signed in to change notification settings - Fork 10
/
compute.tf
33 lines (30 loc) · 935 Bytes
/
compute.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
data "archive_file" "evidence_lambda_zip" {
type = "zip"
source {
content = templatefile("${path.module}/evidence.py.tpl",
{
bucket = aws_s3_bucket.evidence.id
})
filename = "evidence.py"
}
output_path = "${path.module}/evidence.zip"
}
resource "time_sleep" "wait_15_seconds_compute" {
depends_on = [data.archive_file.evidence_lambda_zip]
create_duration = "15s"
}
resource "aws_lambda_function" "evidence" {
filename = "${path.module}/evidence.zip"
function_name = "evidence"
role = aws_iam_role.evidence_lambda.arn
handler = "evidence.lambda_handler"
runtime = "python3.8"
publish = true
memory_size = 512
timeout = 30
depends_on = [time_sleep.wait_15_seconds_compute]
}
resource "aws_cloudwatch_log_group" "lambda" {
name = "/aws/lambda/${aws_lambda_function.evidence.function_name}"
retention_in_days = 1
}