databricks / terraform-provider-databricks

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

[ISSUE] Issue with `databricks_sql_endpoint` resource when applying/reverting serverless compute option #4131

Open pra91 opened 1 month ago

pra91 commented 1 month ago

Changing a databricks_sql_endpoint resource to turn serverless on/off (via enable_serverless_compute) fails to update all expected config attached to the endpoint before trying to apply the changes. This results in the terraform apply failing, as it tries to enable/disable serverless with the older, now invalid config.

Configuration

First Apply

resource "databricks_sql_endpoint" "example_failure" {
  name                 = "sql-endpoint"
  cluster_size         = "2X-Small"
  min_num_clusters     = 1
  max_num_clusters     = 1
  warehouse_type            = "PRO"
  enable_serverless_compute = true
  auto_stop_mins            = 1
}

Second Apply

resource "databricks_sql_endpoint" "example_failure" {
  name                 = "sql-endpoint"
  cluster_size         = "2X-Small"
  min_num_clusters     = 1
  max_num_clusters     = 1
  warehouse_type            = "PRO"
  enable_serverless_compute = false
  auto_stop_mins            = 0
}

Expected Behavior

The endpoint should have had serverless turned off, and defaulted to being always on (0 auto_stop_mins)

Actual Behavior

Apply fails, with error Error: cannot update sql endpoint: 1 is not a valid value for auto_stop_mins. The value must be greater than or equal to 10.

Steps to Reproduce

Terraform and provider versions

terraform version 1.9.7 Databricks provider version 1.54.0

Is it a regression?

No

Debug Output

Important Factoids

Would you like to implement a fix?