-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.tf
27 lines (24 loc) · 852 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
resource "random_pet" "this" {
length = 1
keepers = {
sse_encrypt = var.sse_encrypt
}
}
resource "aws_s3_object" "this" {
for_each = fileset(var.file_path, "**")
content_type = lookup(jsondecode(file("${path.module}/src/mime.json")), regex("\\.[^.]+$", each.value), "text/plain")
content_language = var.content_language
cache_control = var.cache_control
acl = var.acl
bucket = var.bucket_id
storage_class = var.storage_class
key = each.value
source = "${var.file_path}/${each.value}"
etag = filemd5("${var.file_path}/${each.value}")
server_side_encryption = random_pet.this.keepers["sse_encrypt"] ? "AES256" : null
lifecycle {
replace_triggered_by = [
random_pet.this
]
}
}