digitalocean / terraform-provider-digitalocean

Terraform DigitalOcean provider
https://registry.terraform.io/providers/digitalocean/digitalocean/latest/docs
Mozilla Public License 2.0
500 stars 268 forks source link

Spaces Bucket import doesn't contain all the fields. #1039

Open fuadnafiz98 opened 11 months ago

fuadnafiz98 commented 11 months ago

Bug Report


Describe the bug

While I am using the terraform import command to import a digitalocean spaces, It can successfully imported, but few fields are missing.

This can be noticed when I run terraform plan. This shows that it should update in place where in fact it should show no changes needed.

resource "digitalocean_spaces_bucket" "test" {
      + acl                = "private"
      + force_destroy      = false
        id                 = "test"
        name               = "test"
        # (4 unchanged attributes hidden)
        # (1 unchanged block hidden)
    }

Affected Resource(s)

Expected Behavior

It should plan out the import without any changes.

Actual Behavior

It shows that it would update in place.

resource "digitalocean_spaces_bucket" "test" {
      + acl                = "private"
      + force_destroy      = false
        id                 = "test"
        name               = "test"
        # (4 unchanged attributes hidden)
        # (1 unchanged block hidden)
    }

Steps to Reproduce

  1. terraform import digitalocean_spaces_bucket.foobar region,name
  2. terraform plan. Terraform Configuration Files

Terraform version

Debug Output

Panic Output

Additional context

Important Factoids

References

andrewsomething commented 11 months ago

Hi @fuadnafiz98,

Thanks for raising this.

Unfortunately value of acl is not able to be set on import. You must set it in your configuration file to prevent the diff or run terraform apply if you want to accept the default. It is set using "canned-ACLs," either private or public-read. The S3 compatible API does not provide an endpoint that returns that value.

I do think we can make the force_destroy situation better. As it is an local attribute that defaults to false, we can set that at import and only show a diff if it is set to true in the config.