aminueza / terraform-provider-minio

Terraform provider for managing MinIO S3 buckets and IAM Users.
https://registry.terraform.io/providers/aminueza/minio
GNU Affero General Public License v3.0
233 stars 69 forks source link

Add NonCurrentVersionExpiration to Lifecycle Management Rules #523

Closed sdejong629 closed 10 months ago

sdejong629 commented 11 months ago

Description

We are in need of a way to remove non current items after a certain set of days, thereby cleaning up files that have been deleted but are kept by versioning settings.

Steps to Reproduce

  1. There is currently no support to create a rule to remove non-current versions
  2. Can be done with the MCLI: mc ilm rule add --noncurrent-expire-days 7 minio/test-bucket

Expected behavior: [What you expect to happen] Adding support for this option by Minio: https://github.com/minio/minio-go/blob/master/pkg/lifecycle/lifecycle.go#L50

Maybe something like this:

resource "minio_ilm_policy" "bucket-lifecycle-rules" {
  bucket = minio_s3_bucket.bucket.bucket

  rule {
    id         = "expire-7d"
    noncurrentversionexpiration = "7d"
  }
}

Actual behavior: [What actually happens] Not currently possible

Reproduces how often: [What percentage of the time does it reproduce?] 100%

Versions

1.18.0

Additional Information

Setting the expiration of noncurrent versions can be very helpful in freeing up diskspace as older version are no longer needed. This will also cleanup deleted items which are otherwise kept indefinitely.