diff --git a/README.md b/README.md index 4bd8e6f..16afa1a 100644 --- a/README.md +++ b/README.md @@ -1333,6 +1333,15 @@ list(object({ date = optional(string) storage_class = string })), []) + noncurrent_version_expiration = optional(list(object({ + noncurrent_days = optional(number) + newer_noncurrent_versions = optional(string) + })), []) + noncurrent_version_transition = optional(list(object({ + noncurrent_days = optional(number) + newer_noncurrent_versions = optional(string) + storage_class = string + })), []) })) ``` @@ -1787,6 +1796,15 @@ list(object({ date = optional(string) storage_class = string })), []) + noncurrent_version_expiration = optional(list(object({ + noncurrent_days = optional(number) + newer_noncurrent_versions = optional(string) + })), []) + noncurrent_version_transition = optional(list(object({ + noncurrent_days = optional(number) + newer_noncurrent_versions = optional(string) + storage_class = string + })), []) })) ``` diff --git a/rds-s3-dumps.tf b/rds-s3-dumps.tf index 4cdbc52..c1377fe 100644 --- a/rds-s3-dumps.tf +++ b/rds-s3-dumps.tf @@ -217,6 +217,23 @@ resource "aws_s3_bucket_lifecycle_configuration" "rds_dumps" { storage_class = transition.value.storage_class } } + + dynamic "noncurrent_version_expiration" { + for_each = rule.value.noncurrent_version_expiration + content { + noncurrent_days = noncurrent_version_expiration.value.noncurrent_days + newer_noncurrent_versions = noncurrent_version_expiration.value.newer_noncurrent_versions + } + } + + dynamic "noncurrent_version_transition" { + for_each = rule.value.noncurrent_version_transition + content { + noncurrent_days = noncurrent_version_transition.value.noncurrent_days + newer_noncurrent_versions = noncurrent_version_transition.value.newer_noncurrent_versions + storage_class = noncurrent_version_transition.value.storage_class + } + } } } } diff --git a/s3.tf b/s3.tf index b80134a..2a212c4 100644 --- a/s3.tf +++ b/s3.tf @@ -83,6 +83,23 @@ resource "aws_s3_bucket_lifecycle_configuration" "this" { storage_class = transition.value.storage_class } } + + dynamic "noncurrent_version_expiration" { + for_each = rule.value.noncurrent_version_expiration + content { + noncurrent_days = noncurrent_version_expiration.value.noncurrent_days + newer_noncurrent_versions = noncurrent_version_expiration.value.newer_noncurrent_versions + } + } + + dynamic "noncurrent_version_transition" { + for_each = rule.value.noncurrent_version_transition + content { + noncurrent_days = noncurrent_version_transition.value.noncurrent_days + newer_noncurrent_versions = noncurrent_version_transition.value.newer_noncurrent_versions + storage_class = noncurrent_version_transition.value.storage_class + } + } } } } diff --git a/variables.tf b/variables.tf index fd412d8..167ab98 100644 --- a/variables.tf +++ b/variables.tf @@ -804,6 +804,15 @@ variable "rds_s3_dump_lifecycle_rules" { date = optional(string) storage_class = string })), []) + noncurrent_version_expiration = optional(list(object({ + noncurrent_days = optional(number) + newer_noncurrent_versions = optional(string) + })), []) + noncurrent_version_transition = optional(list(object({ + noncurrent_days = optional(number) + newer_noncurrent_versions = optional(string) + storage_class = string + })), []) })) validation { @@ -1196,6 +1205,15 @@ variable "s3_lifecycle_rules" { date = optional(string) storage_class = string })), []) + noncurrent_version_expiration = optional(list(object({ + noncurrent_days = optional(number) + newer_noncurrent_versions = optional(string) + })), []) + noncurrent_version_transition = optional(list(object({ + noncurrent_days = optional(number) + newer_noncurrent_versions = optional(string) + storage_class = string + })), []) })) validation {