From e2a09b415e53f100d2ad9629c04495fb6ad7d519 Mon Sep 17 00:00:00 2001 From: Herman Wong Date: Thu, 21 Nov 2024 14:29:24 -0800 Subject: [PATCH] Remove default lifecycle rules. --- README.md | 22 ++++++++++++++++++++++ variables.tf | 23 ++++------------------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 5df2b8b..f62467f 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,28 @@ module "s3_bucket" { } ``` +If you do not specify lifecycle rules when calling this module, none will be created. +Custom lifecycle rules: +``` +enable_lifecycle_configuration_rules = true +lifecycle_configuration_rules = [ + { + id = "default" + enabled = true + + enable_glacier_transition = true + enable_current_object_expiration = true + enable_noncurrent_version_expiration = true + + abort_incomplete_multipart_upload_days = 1 + noncurrent_version_glacier_transition_days = 90 + noncurrent_version_expiration_days = 365 + glacier_transition_days = 90 + expiration_days = 365 + } + ] +``` + ## Requirements diff --git a/variables.tf b/variables.tf index c0dbce1..ce0f467 100644 --- a/variables.tf +++ b/variables.tf @@ -47,15 +47,15 @@ variable "kms_master_key_id" { variable "enable_lifecycle_configuration_rules" { type = bool - default = true + default = false description = "enable or disable lifecycle_configuration_rules" } variable "lifecycle_configuration_rules" { type = list(object({ - id = string + id = optional(string) prefix = optional(string, null) - enabled = bool + enabled = optional(bool) tags = optional(map(string), null) enable_glacier_transition = optional(bool, true) @@ -74,22 +74,7 @@ variable "lifecycle_configuration_rules" { deeparchive_transition_days = optional(number, null) expiration_days = optional(number, null) })) - default = [ - { - id = "default" - enabled = true - - enable_glacier_transition = true - enable_current_object_expiration = true - enable_noncurrent_version_expiration = true - - abort_incomplete_multipart_upload_days = 1 - noncurrent_version_glacier_transition_days = 90 - noncurrent_version_expiration_days = 365 - glacier_transition_days = 90 - expiration_days = 365 - } - ] + default = [] description = "A list of lifecycle rules" }