-
Notifications
You must be signed in to change notification settings - Fork 0
/
lambda.tf
33 lines (30 loc) · 1.16 KB
/
lambda.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" "startec2_lambda_package" {
type = "zip"
source_file = "${path.module}/lambda-scripts/start_ec2instance.py"
output_path = "startec2.zip"
}
data "archive_file" "stopec2_lambda_package" {
type = "zip"
source_file = "${path.module}/lambda-scripts/stop_ec2instance.py"
output_path = "stopec2.zip"
}
resource "aws_lambda_function" "start_app_lambda" {
function_name = "start_app_lambda"
filename = "startec2.zip"
source_code_hash = data.archive_file.startec2_lambda_package.output_base64sha256
role = aws_iam_role.lambda_role.arn
runtime = "python3.8"
handler = "start_ec2instance.lambda_handler"
timeout = 60
memory_size = 128
}
resource "aws_lambda_function" "stop_app_lambda" {
function_name = "stop_app_lambda"
filename = "stopec2.zip"
source_code_hash = data.archive_file.stopec2_lambda_package.output_base64sha256
role = aws_iam_role.lambda_role.arn
runtime = "python3.8"
handler = "stop_ec2instance.lambda_handler"
timeout = 60
memory_size = 128
}