diff --git a/README.md b/README.md index c514213..8e170c9 100644 --- a/README.md +++ b/README.md @@ -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"] diff --git a/VARIABLES.md b/VARIABLES.md index d6cb578..bb95ff2 100644 --- a/VARIABLES.md +++ b/VARIABLES.md @@ -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 diff --git a/s3.tf b/s3.tf index 03938d0..54b7c5a 100644 --- a/s3.tf +++ b/s3.tf @@ -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" { diff --git a/variables.tf b/variables.tf index d3529bf..e9d82a2 100644 --- a/variables.tf +++ b/variables.tf @@ -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 = <