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

[ISSUE] Issue with `databricks_schema` resource - "UpdateSchema Nothing to update"

Open liahagan opened this issue 5 months ago • 0 comments

Terraform returns an error when updating force_destroy or removing comment on the databricks_schema resource. Based on the debug logs, It looks like the issue occurs because the provider passes an empty object to the PATCH endpoint for schemas.

Configuration

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

resource "databricks_schema" "this" {
  name          = "force_destroy_test_schema"
  catalog_name  = databricks_catalog.this.name
  comment       = "Test"
  force_destroy = true
}

Expected Behavior

  • Terraform should apply changes to force_destroy and removal of comment without errors.
  • The schema comment should be deleted (or set to an empty string) on the actual resource.

Actual Behavior

Terraform returns an error message:

Error: cannot update schema: UpdateSchema Nothing to update.

  • force_destroy is properly updated in Terraform state
  • comment is properly updated in Terraform state but not in the actual resource. Subsequent terraform plan commands do not detect the difference between TF state and reality.

Steps to Reproduce

  1. terraform apply
  2. Comment out or remove comment and force_destroy
  3. terraform apply

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

2024-09-25T18:04:28.335+0200 [DEBUG] provider.terraform-provider-databricks_v1.52.0: PATCH /api/2.1/unity-catalog/schemas/force_destroy_test_catalog.force_destroy_test_schema
> {}
< HTTP/2.0 400 Bad Request
< {
<   "details": [
<     {
<       "@type": "type.googleapis.com/google.rpc.ErrorInfo",
<       "domain": "unity-catalog.databricks.com",
<       "metadata": {
<         "field_name": "schema_info"
<       },
<       "reason": "INVALID_FIELD"
<     },
<     {
<       "@type": "type.googleapis.com/google.rpc.RequestInfo",
<       "request_id": "2545238d-6d1c-4472-83a7-3233c9b0af12",
<       "serving_data": ""
<     }
<   ],
<   "error_code": "INVALID_PARAMETER_VALUE",
<   "message": "UpdateSchema Nothing to update."
< }: tf_req_id=bdf3b3df-83b5-724b-3e65-1cba60664517 @caller=/home/runner/work/terraform-provider-databricks/terraform-provider-databricks/logger/logger.go:38 tf_mux_provider=tf5to6server.v5tov6Server tf_provider_addr=registry.terraform.io/databricks/databricks @module=databricks tf_rpc=ConfigureProvider timestamp="2024-09-25T18:04:28.335+0200"
2024-09-25T18:04:28.336+0200 [DEBUG] provider.terraform-provider-databricks_v1.52.0: non-retriable error: UpdateSchema Nothing to update.: tf_mux_provider=tf5to6server.v5tov6Server tf_provider_addr=registry.terraform.io/databricks/databricks tf_req_id=bdf3b3df-83b5-724b-3e65-1cba60664517 @caller=/home/runner/work/terraform-provider-databricks/terraform-provider-databricks/logger/logger.go:38 @module=databricks tf_rpc=ConfigureProvider timestamp="2024-09-25T18:04:28.336+0200"
2024-09-25T18:04:28.336+0200 [ERROR] provider.terraform-provider-databricks_v1.52.0: Response contains error diagnostic: @caller=/home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov6/internal/diag/diagnostics.go:58 tf_req_id=ae776571-ea6c-43e4-674e-97d782b905ec @module=sdk.proto tf_resource_type=databricks_schema diagnostic_detail="" diagnostic_severity=ERROR diagnostic_summary="cannot update schema: UpdateSchema Nothing to update." tf_rpc=ApplyResourceChange tf_proto_version=6.6 tf_provider_addr=registry.terraform.io/databricks/databricks timestamp="2024-09-25T18:04:28.336+0200"

Important Factoids

  • Using Azure Databricks

Would you like to implement a fix?

No

liahagan avatar Sep 25 '24 16:09 liahagan