# Platform #336: the data bucket's noncurrent versions expire after # data_noncurrent_days (7 by default), expired delete markers go, and # current objects never expire. mock_provider "aws" {} variables { deployment_bucket_name = "dep" data_bucket_name = "data" } run "data_noncurrent_versions_expire_after_seven_days" { command = plan assert { condition = length([ for r in aws_s3_bucket_lifecycle_configuration.data.rule : r if r.id == "expire-noncurrent" && r.status == "Enabled" && one(r.noncurrent_version_expiration).noncurrent_days == 7 && one(r.expiration).expired_object_delete_marker == true ]) == 1 error_message = "the data bucket must expire noncurrent versions after 7 days and clear expired delete markers" } } run "data_noncurrent_days_is_configurable" { command = plan variables { data_noncurrent_days = 30 } assert { condition = one(one(aws_s3_bucket_lifecycle_configuration.data.rule).noncurrent_version_expiration).noncurrent_days == 30 error_message = "data_noncurrent_days must set the noncurrent expiry" } } run "data_noncurrent_days_refuses_zero" { command = plan variables { data_noncurrent_days = 0 } expect_failures = [var.data_noncurrent_days] }