Description
OSS lifecycle rules delete matching objects or move them to another storage class. A disabled rule does not perform its scheduled lifecycle actions.
Potential impact
Unneeded objects may remain longer, increasing storage costs or exceeding organizational retention requirements.
Remediation
Confirm the object scope and required retention before enabling lifecycle_rule. Expiration can delete existing objects, so exclude data that must be retained.
Examples
The examples enable expiration after 365 days for objects under path1/. The public-read ACL is separate; also check whether public access is needed.
Before
hcl
resource "alicloud_oss_bucket" "example" {
bucket = "bucket-170309-lifecycle"
acl = "public-read"
lifecycle_rule {
id = "rule-days"
prefix = "path1/"
enabled = false
expiration {
days = 365
}
}
}
After
hcl
resource "alicloud_oss_bucket" "example" {
bucket = "bucket-170309-lifecycle"
acl = "public-read"
lifecycle_rule {
id = "rule-days"
prefix = "path1/"
enabled = true
expiration {
days = 365
}
}
}