databricks / terraform-provider-databricks

Databricks Terraform Provider
https://registry.terraform.io/providers/databricks/databricks/latest
Other
450 stars 388 forks source link

[ISSUE] Issue with `databricks_catalog` resource regarding renaming #2481

Open JonasDev1 opened 1 year ago

JonasDev1 commented 1 year ago

Configuration

resource "databricks_catalog" "sandbox" {
  metastore_id = local.metastore_id
  name         = var.catalog_name
  storage_root = local.s3_location
  owner        = local.group_name
  comment      = "this catalog is managed by terraform"
  depends_on = [
    databricks_external_location.sandbox
  ]
}

Expected Behavior

Since version 1.19.0 it's possible to rename a existing Unity catalog in terraform without a replacement. This should work

Actual Behavior

The terraform plan shows the correct action, but the apply is not possible:

Plan:

# databricks_catalog.sandbox will be updated in-place
  ~ resource "databricks_catalog" "sandbox" {
        id             = "sandbox_xxx_new"
      ~ name           = "sandbox_xxx_new" -> "sandbox_xxx"
        # (6 unchanged attributes hidden)
    }

Apply:

databricks_catalog.sandbox: Modifying... [id=sandbox_xxx_new]
╷
│ Error: cannot update catalog: Catalog 'sandbox_xxx' does not exist.
│ 
│   with databricks_catalog.sandbox,
│   on unity.tf line 9, in resource "databricks_catalog" "sandbox":
│    9: resource "databricks_catalog" "sandbox" {
│ 
╵

Terraform and provider versions

Provider version 1.19.0

nkvuong commented 1 year ago

@JonasDev1 thank you for flagging this - there is an underlying issue with the go sdk where it does not allow a rename operation