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

[ISSUE] Issue with `databricks_catalog_workspace_binding` resource - BINDING is not recreated when external_catalog is recreated

Open VOVELEE opened this issue 1 year ago • 1 comments

Configuration

  • I have a configuration for couple of external catalogs with specific Databricks workspace bindings
  • I had to change one of the catalogs to point to a different connection. Changing connection_name to databricks_catalog forced recreation of the catalog
  • The recreation of the catalog flushed all bindings created to the catalog
  • However as the id of the catalog is not changed -> databricks_catalog_workspace_binding are not recreated even when explicit depends_on is configured
  • Tested with 1.36.3
  • Note: This might be expected behavior and might be caused in the way I manage catalog and bindings

Expected Behavior

  • Bindings to be recreated when catalog is replaced
 module.solutions.databricks_catalog.external["ext_monitoring"] must be replaced
-/+ resource "databricks_catalog" "external" {
      ~ connection_name = "old-connection" -> "new-connection" # forces replacement
      ~ id              = "ext_monitoring" -> (known after apply)
        name            = "ext_monitoring"
        # (5 unchanged attributes hidden)
    }

  # module.solutions.databricks_catalog_workspace_binding.external-default["ext_monitoring"] must be replaced
-/+ resource "databricks_catalog_workspace_binding" "external-default" {
      ~ id             = "777665544332211|catalog|ext_monitoring" # forces replacement
        # (3 unchanged attributes hidden)
    }

Actual Behavior

 module.solutions.databricks_catalog.external["ext_monitoring"] must be replaced
-/+ resource "databricks_catalog" "external" {
      ~ connection_name = "old-connection" -> "new-connection" # forces replacement
      ~ id              = "ext_monitoring" -> (known after apply)
        name            = "ext_monitoring"
        # (5 unchanged attributes hidden)
    }

nothing for workspace bindings

Steps to Reproduce

See Configuration

Terraform and provider versions

  • Terraform 1.3.10
  • Databricks provider 1.36.3

Is it a regression?

I don't know.

Debug Output

See above

Important Factoids

Would you like to implement a fix?

VOVELEE avatar Feb 27 '24 15:02 VOVELEE

@VOVELEE I suspect this is to do with how you are specifying the catalog in the catalog_workspace_binding - you should refer to a databricks_catalog attribute, rather than a var, otherwise TF would not understand the dependencies and won't re-create the resources accordingly

nkvuong avatar Apr 05 '24 11:04 nkvuong