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] Can't add new tables to databricks_share resource #3517

Open
keyunjie96 opened this issue Apr 27, 2024 · 4 comments
Open

[ISSUE] Can't add new tables to databricks_share resource #3517

keyunjie96 opened this issue Apr 27, 2024 · 4 comments
Labels
plugin framework This issue will be resolved when we migrate towards using the plugin framework.

Comments

@keyunjie96
Copy link

keyunjie96 commented Apr 27, 2024

Hello, it seems Terraform doesn't support adding new tables to an existing delta share, please the diff and stack trace below:

  # databricks_share.created_share_data_sdi_db_ingest_aws_prod_ca_central_1 will be updated in-place
  ~ resource "databricks_share" "share_name" {
        id         = "share_id"
        name       = "share_name"
        # (3 unchanged attributes hidden)

      ~ object {
          ~ name                        = "main.schema_name.c" -> "main.schema_name.a"
            # (8 unchanged attributes hidden)
        }
      + object {
          + data_object_type = "TABLE"
          + name             = "main.schema_name.b"
        }
      + object {
          + data_object_type = "TABLE"
          + name             = "main.schema_name.c"
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.
databricks_share.share_name: Modifying... [id=share_id]
╷
│ Error: cannot update share: UpdateShare duplicate updates on the same data object with data object type: TABLE, names: [schema_name.c].
│ 
│   with databricks_share.share_name,
│   on main.tf.json line 863, in resource[21].databricks_share.share_name:
│  863:             }
│ 
╵

And we are following the suggestion from https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/share#example-usage to sort objects alphabetically

In Terraform configuration, it is recommended to define objects in alphabetical order of their name arguments, so that you get consistent and readable diff. Whenever objects are added or removed, or name is renamed, you'll observe a change in the majority of tasks. It's related to the fact that the current version of the provider treats object blocks as an ordered list. Alternatively, object block could have been an unordered set, though end-users would see the entire block replaced upon a change in single property of the task.

Configuration

We first deployed

            "databricks_share": {
                "share_name": {
                    "name": "share_name",
                    "object": [
                        {
                            "data_object_type": "TABLE",
                            "name": "main.schema_name.c"
                        }
                    ],
                    "owner": "owner@databricks.com"
                }
            }

Then we added a few more tables then it looks like

            "databricks_share": {
                "share_name": {
                    "name": "share_name",
                    "object": [
                        {
                            "data_object_type": "TABLE",
                            "name": "main.schema_name.a"
                        },
                        {
                            "data_object_type": "TABLE",
                            "name": "main.schema_name.b"
                        },
                        {
                            "data_object_type": "TABLE",
                            "name": "main.schema_name.c"
                        }
                    ],
                    "owner": "owner@databricks.com"
                }
            }

Expected Behavior

Users should be able to add new tables if needed.

Actual Behavior

I assume it treats main.schema_name.c as a new table then tried to add it but it find it is duplicated with the existing one.

Steps to Reproduce

1.41.0

Is it a regression?

Probably no.

Debug Output

Please check the ticket

Important Factoids

This is also tracked internally at https://databricks.atlassian.net/browse/ES-1110321. You can see more debugging logs there

Would you like to implement a fix?

@alexott
Copy link
Contributor

alexott commented Apr 27, 2024

please collect logs as per troubleshooting guide...

@keyunjie96
Copy link
Author

@alexott I add to go/zerobin. I don't think I can share full logs publicly

@alexott
Copy link
Contributor

alexott commented Apr 30, 2024

You can post it internally, without pasting link here

@keyunjie96
Copy link
Author

The Jenkins run has been included in the ticket since the beginning

@tanmay-db tanmay-db added the plugin framework This issue will be resolved when we migrate towards using the plugin framework. label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin framework This issue will be resolved when we migrate towards using the plugin framework.
Projects
None yet
Development

No branches or pull requests

3 participants