-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
52 lines (47 loc) · 1.36 KB
/
main.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
variable "rookout_token" {
type = string
}
resource "aws_iam_role" "iam_for_lambda" {
name = "iam_for_lambda"
managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"]
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
resource "aws_lambda_function" "test_lambda" {
# If the file is not in the current working directory you will need to include a
# path.module in the filename.
filename = "payload.zip"
function_name = "matt-rookout"
role = aws_iam_role.iam_for_lambda.arn
handler = "main.handler"
timeout = 10
# layers = [
# "arn:aws:lambda:us-east-1:032275105219:layer:rookout_python39_v_0_1_169_1:1"
# ]
# 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("payload.zip")
runtime = "python3.9"
environment {
variables = {
ROOKOUT_TOKEN = var.rookout_token
ROOKOUT_ROOK_TAGS = "lambda"
ROOKOUT_DEBUG = 1
ROOKOUT_LOG_TO_STDERR = 1
}
}
}