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

'minio_s3_bucket' with versioning can't be destroyed #509

Closed nixargh closed 1 year ago

nixargh commented 1 year ago

Looks like provider doesn't remove versions of objects but just the actual version while doing force destroy. As the result terraform shows no errors but fails by timeout. After manual versions removement the bucket can be deleted.

Steps to Reproduce

  1. Create bucket with versioning.
  2. Copy some file.
  3. Copy some other file to the same object (to be sure it has versions).
  4. Set force_destroy option for bucket if haven't been set yet.
  5. Try to destroy the bucket.
  6. Delete versions.
  7. Delete the bucket.

I expect provider finds and deletes all versions of all objects to make force destroy. Now versioning bucket can't be deleted via Terraform.

Provider version: 1.17.2.

Screenshot with error: 2023-09-06_10-11

nixargh commented 1 year ago

Guys, please, say something to let me know whether you care about or not.

felladrin commented 1 year ago

Hi @nixargh thanks for reporting!

We do care, but we're also needing more hands to keep the project up. This provider is not sponsored by any company, and we're all using our free time to maintain it.

@pjsier has opened a PR to address this issue, if you can try the solution and confirm it works, it already helps! Or if you'd like to join the maintainers team, you'd be more than welcome!

nixargh commented 1 year ago

Thank you for the answer, that is what I wanted to know and I fully understand that it is not your job. But it's important to know you are still interested in this provider as it is the best I found so far. You can rely on me for testing. Regarding being a maintainer, I have some limited Go experience but zero of writing Terraform providers, so it was my plan B in case you can't/won't fix it. Maybe I'll find time to dig into another issue I opened.

Anyway, thanks for your job folks.

pjsier commented 1 year ago

Appreciate the understanding and help @nixargh! If you have a chance to test that PR let us know if that addresses the issue for you and we can go ahead and get that in the next release

nixargh commented 1 year ago

@pjsier, I've tested your branch and it works as expected, I mean a bucket with all its objects include versions was tottally destroyed. The end of Terraform log to check that it was locally built provider:

module.minio-objects.minio_s3_bucket.bucket["test2"]: Destruction complete after 0s
2023-10-09T10:24:57.992Z [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2023-10-09T10:24:57.993Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-10-09T10:24:57.997Z [DEBUG] provider: plugin process exited: path=.terraform/providers/terraform.local/aminueza/minio/1.4.0/linux_amd64/terraform-provider-minio pid=13736
2023-10-09T10:24:57.997Z [DEBUG] provider: plugin exited