forked from aehrc/terraform-aws-serverless-beacon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
layers.tf
49 lines (37 loc) · 1.38 KB
/
layers.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
### binaries layer
# data for the binaries_layer layer
data "archive_file" "binaries_layer" {
type = "zip"
source_dir = "${path.module}/layers/binaries/"
output_path = "${path.module}/binaries.zip"
}
# binaries layer definition
resource "aws_lambda_layer_version" "binaries_layer" {
filename = data.archive_file.binaries_layer.output_path
layer_name = "binaries_layer"
source_code_hash = filebase64sha256("${data.archive_file.binaries_layer.output_path}")
compatible_runtimes = ["python3.9"]
}
### python thirdparty libraries layer
# contains pynamodb, jsons, jsonschema, smart_open
module "python_libraries_layer" {
source = "terraform-aws-modules/lambda/aws"
create_layer = true
layer_name = "python_libraries_layer"
description = "python libraries"
compatible_runtimes = ["python3.9"]
source_path = "${path.module}/layers/python_libraries/"
store_on_s3 = true
s3_bucket = aws_s3_bucket.lambda-layers-bucket.bucket
}
### python first party modules layer
module "python_modules_layer" {
source = "terraform-aws-modules/lambda/aws"
create_layer = true
layer_name = "python_modules_layer"
description = "python libraries"
compatible_runtimes = ["python3.9"]
source_path = "${path.module}/shared_resources/python-modules/"
store_on_s3 = true
s3_bucket = aws_s3_bucket.lambda-layers-bucket.bucket
}