Skip to content

Commit

Permalink
rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
javsanbel2 committed Dec 9, 2024
1 parent ea901e4 commit e7bd8a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,23 @@ resource "aws_s3_bucket_lifecycle_configuration" "apiary_data_bucket_versioning_
for schema in local.schemas_info : "${schema["schema_name"]}" => schema
}
bucket = each.value["data_bucket"]
# Rule only enabled when expiration days are set
# Rule enabled when expiration max days is set
rule {
id = "expire-noncurrent-versions-days"
status = lookup(each.value, "noncurrent_version_expiration_days", "") != "" && lookup(each.value, "newer_noncurrent_versions", "") == "" ? "Enabled" : "Disabled"
status = lookup(each.value, "s3_versioning_expiration_days", "") != "" && lookup(each.value, "s3_versioning_max_versions_retained", "") == "" ? "Enabled" : "Disabled"

noncurrent_version_expiration {
noncurrent_days = tonumber(lookup(each.value, "s3_noncurrent_version_expiration_days", var.noncurrent_version_expiration_days))
noncurrent_days = tonumber(lookup(each.value, "s3_versioning_expiration_days", var.s3_versioning_expiration_days))
}
}
# Rule enabled when expiration days and versions are set
# Rule enabled when expiration max days and versions are set
rule {
id = "expire-noncurrent-versions-number"
status = lookup(each.value, "newer_noncurrent_versions", "") != "" ? "Enabled" : "Disabled"
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, "newer_noncurrent_versions", var.newer_noncurrent_versions))
noncurrent_days = tonumber(lookup(each.value, "s3_noncurrent_version_expiration_days", var.noncurrent_version_expiration_days))
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))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1095,13 +1095,13 @@ variable "ecs_requires_compatibilities" {
default = ["EC2", "FARGATE"]
}

variable "noncurrent_version_expiration_days" {
variable "s3_versioning_expiration_days" {
description = "Number of days (TTL) before objects are expired. Bucket need to have versioning enabled."
type = number
default = 7
}

variable "newer_noncurrent_versions" {
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
Expand Down

0 comments on commit e7bd8a5

Please sign in to comment.