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 resource_minio_s3_object 'source' support #555

Closed fhemberger closed 5 months ago

fhemberger commented 8 months ago

Add resource_minio_s3_object 'source' support for PutObject

Only 'content' and 'content_base64' have been implemented sofar, this PR adds 'source' support for resource_minio_s3_object, derived from https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/s3/bucket_object.go#L388-L405

Reference

Closing issues

pjsier commented 7 months ago

Sorry for the delay in looking at this! It would be great to add some test cases here for CI if you have a chance

fhemberger commented 7 months ago

@pjsier Is there some sort of 'best practice' for testing opening/reading files in Go? I've only dabbled a bit in the language so far and I don't know much about writing unit tests in it.

pjsier commented 7 months ago

@fhemberger I'm not sure on overall best practices, but I think we could leverage a similar pattern to the AWS provider adding a method to create tempfiles that can then be used later in the test

https://github.com/hashicorp/terraform-provider-aws/blob/43bd19db00807459b8c5ae3b4faaa91a183d3a7f/internal/service/s3/object_test.go#L702-L734

fhemberger commented 6 months ago

@pjsier I'm still having trouble setting up the unit tests, however, I'd really appreciate it if the fix could land anyways, as:

  1. The source attribute is currently documented to be available, yet it's not implemented at all
  2. There hasn't been a single unit test for minio_s3_object so far to build on.
  3. The code is taken directly from Hashicorp's own official AWS provider.

So even without test cases, that's already an improvement over the current state.

fhemberger commented 5 months ago

/ping @pjsier @felladrin

felladrin commented 5 months ago

Thanks @fhemberger! It's being released on v2.1.0.

fhemberger commented 5 months ago

@felladrin Thank you!