terraform-provider-digitalocean icon indicating copy to clipboard operation
terraform-provider-digitalocean copied to clipboard

Spaces Bucket import doesn't contain all the fields.

Open fuadnafiz98 opened this issue 1 year ago • 1 comments

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

fuadnafiz98 avatar Oct 02 '23 04:10 fuadnafiz98

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.

andrewsomething avatar Oct 02 '23 15:10 andrewsomething