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

[ISSUE] Issue with `databricks_schema` resource - force_delete fails to delete models

Open liahagan opened this issue 5 months ago • 1 comments

Configuration

resource "databricks_catalog" "this" {
  name = "force_destroy_test"
}

resource "databricks_schema" "this" {
  name          = "schema"
  catalog_name  = databricks_catalog.this.name
  force_destroy = true
}

You also need to create a model and register a model version in the schema outside of Terraform.

Expected Behavior

  • The force_destroy parameter should ensure that Terraform properly destroys every object within the schema before destroying the schema itself.
  • The Error message should indicate correctly what kinds of object still exist in the schema.

Actual Behavior

Terraform returns the following error which wrongly states that there is one function in the schema when there is only a model.

Error: cannot delete schema: Schema 'force_destroy_test.schema' is not empty. The schema has 0 tables(s), 1 functions(s), 0 volumes(s)

Steps to Reproduce

  1. terraform apply
  2. Create a model and register a model version in the schema
  3. terraform destroy

Terraform and provider versions

Terraform v1.7.5 on darwin_amd64

  • provider registry.terraform.io/databricks/databricks v1.52.0
  • provider registry.terraform.io/hashicorp/azurerm v3.116.0

Is it a regression?

Not sure.

Debug Output

https://gist.github.com/liahagan/dabc11e1070e8f9fe926df30c2f1b82e

Important Factoids

Would you like to implement a fix?

liahagan avatar Sep 25 '24 17:09 liahagan