Skip to content

Commit cbf62f2

Browse files
Merge pull request #2 from QuiNovas/develop
Added server-side encryption
2 parents 3cfac56 + d87890e commit cbf62f2

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

main.tf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
resource "aws_s3_bucket" "log" {
2-
bucket = "${var.name_prefix}-log"
32
acl = "log-delivery-write"
3+
bucket = "${var.name_prefix}-log"
44
lifecycle {
55
prevent_destroy = true
66
}
77
lifecycle_rule {
88
id = "log"
9-
prefix = "/"
109
enabled = true
1110

1211
transition {
13-
days = 30
12+
days = "${var.transition_to_glacier}"
1413
storage_class = "GLACIER"
1514
}
1615

1716
expiration {
18-
days = 2555
17+
days = "${var.expiration}"
18+
}
19+
}
20+
server_side_encryption_configuration {
21+
rule {
22+
apply_server_side_encryption_by_default {
23+
sse_algorithm = "AES256"
24+
}
1925
}
2026
}
2127
}

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1+
variable "expiration" {
2+
default = 2555
3+
description = "The number of days to wait before expiring an object"
4+
type = "string"
5+
}
6+
17
variable "name_prefix" {
28
description = "The name prefix to use when creating resource names"
39
type = "string"
10+
}
11+
12+
variable "transition_to_glacier" {
13+
default = 30
14+
description = "The number of days to wait before transitioning an object to Glacier"
15+
type = "string"
416
}

0 commit comments

Comments
 (0)