Skip to content

Commit

Permalink
Remove max versions
Browse files Browse the repository at this point in the history
  • Loading branch information
javsanbel2 committed Dec 16, 2024
1 parent 1a37bae commit 96f6d9a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 20 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ module "apiary" {
{
schema_name = "db_s3_versioning_enabled",
s3_versioning_enabled = "Enabled", // Enabled/Disabled/Suspended. Once enabled it can only be suspended
s3_versioning_expiration_days = 2, // If Enabled, default 7
s3_versioning_max_versions_allowed = 1
s3_versioning_expiration_days = 2 // If Enabled, default 7
},
]
apiary_customer_accounts = ["aws_account_no_1", "aws_account_no_2"]
Expand Down
1 change: 0 additions & 1 deletion VARIABLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@
| hms\_ecs\_metrics\_readwrite\_namespace | ECS readonly metrics namespace | `string` | `hmsreadwritelegacy` | no |
| hms\_k8s\_metrics\_readonly\_namespace | K8s readwrite metrics namespace | `string` | `hms_readonly` | no |
| s3\_versioning\_expiration\_days | Number of days (TTL) before objects are expired. Bucket need to have versioning enabled. | `number` | `7` | no |
| s3\_versioning\_max\_versions\_retained | Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer. Bucket need to have versioning enabled. | `number` | `3` | no |

### apiary_assume_roles

Expand Down
12 changes: 1 addition & 11 deletions s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,12 @@ resource "aws_s3_bucket_lifecycle_configuration" "apiary_data_bucket_versioning_
# Rule enabled when expiration max days is set
rule {
id = "expire-noncurrent-versions-days"
status = lookup(each.value, "s3_versioning_expiration_days", "") != "" && lookup(each.value, "s3_versioning_max_versions_retained", "") == "" ? "Enabled" : "Disabled"
status = lookup(each.value, "s3_versioning_expiration_days", "") != "" ? "Enabled" : "Disabled"

noncurrent_version_expiration {
noncurrent_days = tonumber(lookup(each.value, "s3_versioning_expiration_days", var.s3_versioning_expiration_days))
}
}
# Rule enabled when expiration max days and versions are set
rule {
id = "expire-noncurrent-versions-number-and-days"
status = lookup(each.value, "s3_versioning_max_versions_retained", "") != "" ? "Enabled" : "Disabled"

noncurrent_version_expiration {
newer_noncurrent_versions = tonumber(lookup(each.value, "s3_versioning_max_versions_retained", var.s3_versioning_max_versions_retained))
noncurrent_days = tonumber(lookup(each.value, "s3_versioning_expiration_days", var.s3_versioning_expiration_days))
}
}
}

resource "aws_s3_bucket_inventory" "apiary_bucket" {
Expand Down
6 changes: 0 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1101,12 +1101,6 @@ variable "s3_versioning_expiration_days" {
default = 7
}

variable "s3_versioning_max_versions_retained" {
description = "Number of noncurrent versions Amazon S3 will retain. Must be a non-zero positive integer. Bucket need to have versioning enabled."
type = number
default = 3
}

variable "hms_ro_tolerations" {
description = <<EOF
Adds a list of tolerations for the HMS readonly pods. For example if you
Expand Down

0 comments on commit 96f6d9a

Please sign in to comment.