databricks / terraform-provider-databricks

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

[ISSUE] Issue with `databricks_model_serving` resource #3946

Open Vikranth-Subramanian opened 2 months ago

Vikranth-Subramanian commented 2 months ago

Configuration

resource "databricks_model_serving" "this" {
  name = "e5_${local.STICKY_RANDOM}"
  config {
    served_entities {
      name           = "e5_small_v2"
      entity_name    = "${databricks_catalog.databricks_e5_v2_models.id}.models.e5_small_v2"
      entity_version = "2"
      workload_size  = "Small"
      scale_to_zero_enabled = false
    }
    traffic_config {
      routes {
        served_model_name  = "e5_small_v2"
        traffic_percentage = 100
      }
    }
  }
}

Seems like the issue which was resolved here https://github.com/databricks/terraform-provider-databricks/issues/3383 is happening again with databricks provider versions 1.49.0 and above.

Steps to Reproduce

terraform plan works fine but it fails when we try to do terraform apply with the error cannot update model serving: scaleToZeroEnabled is undefined. Please set it to either true or false

Terraform and provider versions

databricks_model_serving resource is broken since 1.49.0

Is it a regression?

Debug Output

Important Factoids

Would you like to implement a fix?

paulzharyukmm commented 1 month ago

Running into the same issue:

Error: cannot update model serving: scaleToZeroEnabled is undefined. Please set it to either true or false.

I noticed that it only works when you set it to true.

paulzharyukmm commented 1 month ago

Can confirm that this issue does not exist on 1.48.3

Vikranth-Subramanian commented 1 month ago

Does adding back ForceSendFields which was added in the PR https://github.com/databricks/terraform-provider-databricks/commit/dbe732e02b2223d32f085f66bd1c5c0707304236#diff-c4af24d835708d4701b7681a821ffeed5cb6ad8958b7f0d32a65f911bda3e693R78 will fix the issue? It was removed in the last PR. @alexott ?

alexott commented 1 month ago

@Vikranth-Subramanian it's a bit complicated as it depends on a specific model.

Cc: @arpitjasa-db

arpitjasa-db commented 1 month ago

Hmm @yucheng-qian-db were any changes made recently on the Model Serving API side?

alexott commented 1 month ago

@arpitjasa-db @yucheng-qian-db I reported this error internally few weeks ago...

yucheng-qian-db commented 1 month ago

No change in API, but we'll make this field no longer required to address this issue.

cpanpalia commented 4 weeks ago

there is one more issue in Documentation

image

https://github.com/databricks/terraform-provider-databricks/blob/main/internal/service/serving_tf/model.go#L753

yucheng-qian-db commented 1 week ago

scale_to_zero_enabled is no longer required. The issue should be fixed.