-
Notifications
You must be signed in to change notification settings - Fork 2
/
pack.tf
41 lines (32 loc) · 865 Bytes
/
pack.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
resource "null_resource" "tmp" {
provisioner "local-exec" {
command = "rm -rf ${var.tmp_dir}/${var.name}; mkdir -p ${var.tmp_dir}/${var.name}"
}
triggers = {
the_trigger = timestamp()
}
}
resource "null_resource" "copy" {
provisioner "local-exec" {
command = "cp -fr ${var.source_dir}/* ${var.tmp_dir}/${var.name}/"
}
depends_on = [null_resource.tmp]
triggers = {
the_trigger = timestamp()
}
}
resource "null_resource" "pip" {
provisioner "local-exec" {
command = "pip3 install -r ${var.source_dir}/requirements.txt -t ${var.tmp_dir}/${var.name}"
}
depends_on = [null_resource.copy]
triggers = {
the_trigger = timestamp()
}
}
data "archive_file" "lambda_zip" {
type = "zip"
source_dir = "${var.tmp_dir}/${var.name}"
output_path = "/tmp/${var.name}.zip"
depends_on = [null_resource.pip]
}