-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.tf
37 lines (32 loc) · 954 Bytes
/
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
resource "aws_s3_bucket" "script_bucket" {
bucket_prefix = "${var.prefix}-etl-scripts"
acl = "private"
versioning {
enabled = true
}
}
// Uploads the main.py script to the S3 bucket
resource "aws_s3_bucket_object" "python_script" {
bucket = aws_s3_bucket.script_bucket.id
key = "main.py"
source = "${path.module}/main.py"
acl = "private"
content_type = "text/x-script.python"
}
// Zips the mappings folder into mappings.zip
resource "null_resource" "zip" {
triggers = {
bucket_prefix = var.prefix
}
provisioner "local-exec" {
command = "cd ${path.module} && zip -r mappings.zip mappings"
}
}
// Uploads the library to the S3 bucket
resource "aws_s3_bucket_object" "zip_library" {
bucket = aws_s3_bucket.script_bucket.id
key = "mappings.zip"
source = "${path.module}/mappings.zip"
acl = "private"
content_type = "application/zip"
}