Skip to content

Commit

Permalink
Allow lifecycle rules for noncurrent objects
Browse files Browse the repository at this point in the history
  • Loading branch information
hajati committed Mar 21, 2024
1 parent 4a5ae68 commit e2d2c8b
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
})), [])
}))
```

Expand Down Expand Up @@ -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
})), [])
}))
```

Expand Down
17 changes: 17 additions & 0 deletions rds-s3-dumps.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
}
17 changes: 17 additions & 0 deletions s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e2d2c8b

Please sign in to comment.