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
242 stars 72 forks source link

Import of existing S3 bucket fails #564

Open steschuser opened 5 months ago

steschuser commented 5 months ago

Description

Trying to import an existing bucket fails

Steps to Reproduce

  1. create a bucket outside of terraform

    > mc mb juice/foo
    Bucket created successfully `juice/foo`.
  2. generate minimal terraform config

    # Import Test
    resource "minio_s3_bucket" "foo" {
    }
  3. try to import

    > terraform import minio_s3_bucket.foo foo
    minio_s3_bucket.foo: Importing from ID "foo"...
    ╷
    │ Error: error importing Minio S3 bucket policy: The specified bucket does not exist.
    │

    Expected behavior: a successfull import :)

Actual behavior: Throws "bucket does not exist"

Reproduces how often: 100%

Versions

Terraform v1.8.4 on linux_amd64

MinIO VERSION 2024-04-18T19:09:19Z

steschuser commented 5 months ago

any love?

lorenzofelletti commented 3 months ago

I tried to reproduce your issue on my setup and didn't have any issue.

My code:

resource "minio_s3_bucket" "test" {
  bucket = "test"
}

Command I run: terraform import -var-file="dev.tfvars" 'minio_s3_bucket.test' 'test' (quoting is important when running terraform imports to avoid unexpected behaviour)

Also, your error seems to refer to a S3 bucket policy, not a bucket: │ Error: error importing Minio S3 bucket policy: The specified bucket does not exist.