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
243 stars 73 forks source link

Add MinIO Bucket Retention Resource #595

Closed SoulKyu closed 2 weeks ago

SoulKyu commented 2 weeks ago

Add MinIO Bucket Retention Resource

Description

This PR adds support for managing MinIO bucket retention (object lock) configurations through Terraform. The new resource minio_s3_bucket_retention enables users to configure WORM (Write-Once Read-Many) retention policies on MinIO buckets.

Features

Example Usage

resource "minio_s3_bucket" "example" {
  bucket          = "my-bucket"
  force_destroy   = true
  object_locking  = true
}

resource "minio_s3_bucket_retention" "example" {
  bucket          = minio_s3_bucket.example.bucket
  mode            = "COMPLIANCE"
  unit            = "DAYS"
  validity_period = 30
}

Implementation Details

Testing

Added acceptance tests covering:

Dependencies

This resource requires:

Documentation

Notes for Reviewers

  1. The resource requires object lock to be enabled during bucket creation
  2. Special attention to validation of retention parameters
  3. Lifecycle rule interaction handling
  4. Error handling for bucket prerequisites

Be careful

This permit to activate WORM on the bucket level. A new resource need to be created to create WORM at object level. But this would maybe be done in another PR.

SoulKyu commented 2 weeks ago

Great addition!

Let me know if you think we should release a v3.2.0 now, or only after your next PR.

You can add it now, won't perform a PR for the moment

felladrin commented 2 weeks ago

Alright! v3.2.0 is on the way!