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

[ISSUE] Issue with `databricks_sql_table` resource

Open dipanjank opened this issue 1 year ago • 1 comments

Configuration

resource "databricks_sql_table" "internal_orderbook_snapshots" {
  name               = "my_test_table"
  catalog_name       = "dev"
  schema_name        = "silver"
  table_type         = "MANAGED"
  data_source_format = "DELTA"

  column {
    name     = "bids_map"
    type     = "map<double, double>"
    comment  = "bid side of the orderbook as a map. key is price, value is quantity."
    nullable = true
  }

Expected Behavior

  • Executing terraform apply to create this table should create the table.
  • Subsequent terraform plan executions with no change in the table configuration should detect that nothing has changed and report no change.

Actual Behavior

  • Executing terraform apply creates this table when it does not exist, as expected.
  • Subsequent plans with no change in the table definition fail with the error message
Error: changing the 'type' of an existing column is not supported
with databricks_sql_table.orderbook_updates_table
on main.tf line 16, in resource "databricks_sql_table" "orderbook_updates_table":
resource "databricks_sql_table" "orderbook_updates_table" {

Steps to Reproduce

  1. terraform apply
  2. terraform plan

Terraform and provider versions

Terraform [v1.9.5] databricks provider is 1.56.0

Is it a regression?

Version 1.52.0 has the same reported behaviour.

Debug Output

Important Factoids

Would you like to implement a fix?

Possibly, but will need some guidance ;)

dipanjank avatar Nov 05 '24 12:11 dipanjank

Try doing a databricks tables get command in the databricks cli on that table and copy+paste your columns type_text into your terraform resource type field. I found that the type_text field for complex types like array<>, map<> and struct<> are unicode escaped in the type_text field but the comparison doesn't take it into account.

Zambonilli avatar May 20 '25 18:05 Zambonilli