Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated the lifecycle information and configurability #3

Merged
merged 2 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}