Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE] Issue with databricks_share update detection #2167

Closed
marekbrysa opened this issue Mar 28, 2023 · 4 comments · Fixed by #2197 or #2307
Closed

[ISSUE] Issue with databricks_share update detection #2167

marekbrysa opened this issue Mar 28, 2023 · 4 comments · Fixed by #2197 or #2307
Assignees

Comments

@marekbrysa
Copy link
Contributor

marekbrysa commented Mar 28, 2023

Configuration

Adding a new object to a databricks_share resource e.g.

databricks_share my_share {
  name = "my_share"
  object {
    data_object_type = "TABLE"
    name = "main.foo.table_A"
  }
  object {
    data_object_type = "TABLE"
    name = "main.foo.table_C"
  }
}

->

databricks_share my_share {
  name = "my_share"
  object {
    data_object_type = "TABLE"
    name = "main.foo.table_A"
  }
  object {
    data_object_type = "TABLE"
    name = "main.foo.table_B"
  }
  object {
    data_object_type = "TABLE"
    name = "main.foo.table_C"
  }
}

Expected Behavior

Object for main.foo.table_B is added to the share

Actual Behavior

Apply fails with cannot update share: Shared Table 'foo.table_C' already exists

When explicitly providing shared_as both before and after adding new object, it works.

Most likely

if !reflect.DeepEqual(beforeSdo, afterSdo) {
does not work as expected.

Steps to Reproduce

Terraform and provider versions

1.10.0

Debug Output

Important Factoids

@marekbrysa marekbrysa changed the title [ISSUE] Issue with databricks_XXX resource [ISSUE] Issue with databricks_share update detection Mar 28, 2023
@marekbrysa
Copy link
Contributor Author

The workaround is to explicitly specify shared_as = "foo.table_X" for all objects in the share, i.e. explicitly set the default value for shared_as.

@junwei-db
Copy link

junwei-db commented May 16, 2023

Re-opening because we observe the issue still persists after the fix in #2197.

Here's another example of the current behavior:

Deleting table A from databricks_share resource,

from:

databricks_share my_share {
  name = "my_share"
  object {
    name = "main.foo.table_A"
    shared_as = "foo.table_A"
  }
  object {
    name = "main.foo.table_B"
    shared_as = "foo.table_B"
  }
}

to:

databricks_share my_share {
  name = "my_share"
  object {
    name = "main.foo.table_B"
    shared_as = "foo.table_B"
  }
}

Expected terraform plan:

table_A is deleted.

Actual terraform plan:

Change table A to table B and delete table B.

databricks_share my_share {
  name = "my_share"
  ~ object {
    ~ name = "main.foo.table_A"  ->  "main.foo.table_B"
    ~ shared_as = "foo.table_A"   ->  "foo.table_B"
  ~ }
  - object {
    - name = "main.foo.table_B"
    - shared_as = "foo.table_B"
  - }
}

This plan will result in failure because changing shared_as is not supported.

The root cause is that terraform is not able to identify the same object, which leads to object mismatch and incorrect plan.

@junwei-db
Copy link

@nkvuong Could you take another look of this issue and see if it's possible to fix? We (system table team) are using delta sharing through terraform extensively, and this issue makes it hard to deploy any share changes. Thanks.

@junwei-db
Copy link

@nfx When is the expected release date for #2307?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants