Skip to content

Commit

Permalink
Merge pull request #3 from QuiNovas/develop
Browse files Browse the repository at this point in the history
updated the lifecycle information and configurability
  • Loading branch information
joseph-wortmann authored Oct 4, 2018
2 parents 3cc904a + 144605f commit 665e0ad
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
13 changes: 6 additions & 7 deletions s3-bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@ resource "aws_s3_bucket" "config" {
acl = "log-delivery-write"
bucket = "${local.config_name}"

lifecycle {
prevent_destroy = true
}

lifecycle_rule {
id = "log"
prefix = "/"
enabled = true

transition {
days = 30
days = "${var.transition_to_glacier}"
storage_class = "GLACIER"
}

expiration {
days = 2555
days = "${var.expiration}"
}
}

lifecycle {
prevent_destroy = true
}

logging {
target_bucket = "${var.log_bucket}"
target_prefix = "s3/${local.config_name}/"
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ variable "enable_recorder" {
type = "string"
}

variable "expiration" {
default = 2555
description = "The number of days to wait before expiring an object"
type = "string"
}

variable "log_bucket" {
description = "The log bucket to write S3 logs to."
type = "string"
Expand Down Expand Up @@ -141,4 +147,10 @@ variable "tags" {
default = {}
description = "A mapping of tags to assign to created resources"
type = "map"
}

variable "transition_to_glacier" {
default = 30
description = "The number of days to wait before transitioning an object to Glacier"
type = "string"
}

0 comments on commit 665e0ad

Please sign in to comment.