Skip to content

Commit 89849cc

Browse files
committed
Adding SSE object level support
1 parent 93544c1 commit 89849cc

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ Used to publish static website files to an S3 bucket with proper MIME type
77
``` Terraform
88
module "s3-static-website" {
99
source = "Lupus-Metallum/s3-static-website/aws"
10-
version = "1.1.0"
10+
version = "1.2.0"
1111
1212
bucket_id = aws_s3_bucket.example.id
1313
file_path = "${path.module}/src/my-website-files/" # Where your index.html and TLD web content lives
1414
acl = "public-read"
1515
storage_class = "STANDARD"
1616
cache_control = "max-age=31536000"
1717
content_language = "en-US"
18+
sse_encrypt = true
1819
}
1920
```

main.tf

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
resource "aws_s3_object" "this" {
22
for_each = fileset(var.file_path, "**")
33

4-
content_type = lookup(jsondecode(file("${path.module}/src/mime.json")), regex("\\.[^.]+$", each.value), null)
5-
content_language = var.content_language
6-
cache_control = var.cache_control
7-
acl = var.acl
8-
bucket = var.bucket_id
9-
storage_class = var.storage_class
10-
key = each.value
11-
source = "${var.file_path}/${each.value}"
12-
etag = filemd5("${var.file_path}/${each.value}")
4+
content_type = lookup(jsondecode(file("${path.module}/src/mime.json")), regex("\\.[^.]+$", each.value), null)
5+
content_language = var.content_language
6+
cache_control = var.cache_control
7+
acl = var.acl
8+
bucket = var.bucket_id
9+
storage_class = var.storage_class
10+
key = each.value
11+
source = "${var.file_path}/${each.value}"
12+
etag = filemd5("${var.file_path}/${each.value}")
13+
server_side_encryption = var.sse_encrypt ? "AES256" : null
1314
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ variable "content_language" {
3131
default = "en-US"
3232
description = "en-US or en-GB for language header?"
3333
}
34+
35+
variable "sse_encrypt" {
36+
type = bool
37+
default = true
38+
description = "Should we apply SSE for objects created by this module?"
39+
}

0 commit comments

Comments
 (0)