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

Allow lifecycle rules for noncurrent objects #84

Merged
merged 2 commits into from
Mar 21, 2024
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
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
Loading