Skip to content

Commit

Permalink
Merge pull request #6 from rafilkmp3/master
Browse files Browse the repository at this point in the history
Add an option to force_destroy the S3 bucket, even is not empty.
  • Loading branch information
jonathanio authored Jan 5, 2018
2 parents 281130d + 6510047 commit 53f6aa9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions s3-content.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
resource "aws_s3_bucket" "content" {
bucket = "s3-cloudfront-${lower(var.name)}-content"
acl = "public-read"
bucket = "s3-cloudfront-${lower(var.name)}-content"
acl = "public-read"
force_destroy = "${var.force_destroy}"

versioning {
enabled = true
Expand Down
5 changes: 3 additions & 2 deletions s3-logs.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
resource "aws_s3_bucket" "logs" {
bucket = "s3-cloudfront-${lower(var.name)}-logs"
acl = "log-delivery-write"
bucket = "s3-cloudfront-${lower(var.name)}-logs"
acl = "log-delivery-write"
force_destroy = "${var.force_destroy}"

lifecycle_rule {
id = "s3-cloudfront-${lower(var.name)}-logs-transitions"
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ variable "tags" {
description = "A map of tags (in addition to Name) to add to all resources."
default = {}
}

variable "force_destroy" {
description = "A boolean that indicates all objects should be deleted from the bucket so that the bucket can be destroyed without error. These objects are not recoverable."
default = "false"
}

0 comments on commit 53f6aa9

Please sign in to comment.