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

[ISSUE] Issue with `databricks_quality_monitor` resource

Open touchida opened this issue 1 year ago • 0 comments

When a quality_monitor resource with the schedule field is created, the terraform plan command always shows an unexpected change for the pause_status read-only field.

Configuration

data "databricks_sql_warehouse" "all" {
  name = "sandbox"
}

resource "databricks_sql_table" "myTestTable" {
  catalog_name       = "sandbox"
  schema_name        = "things"
  name               = "bar"
  table_type         = "MANAGED"
  data_source_format = "DELTA"
  warehouse_id       = data.databricks_sql_warehouse.all.id

  column {
    name = "timestamp"
    type = "int"
  }
}

resource "databricks_quality_monitor" "testTimeseriesMonitor" {
  table_name         = "sandbox.things.${databricks_sql_table.myTestTable.name}"
  assets_dir         = "/Shared/provider-test/databricks_quality_monitoring/${databricks_sql_table.myTestTable.name}"
  output_schema_name = "sandbox.things"
  time_series {
    granularities = ["1 hour"]
    timestamp_col = "timestamp"
  }
  schedule {
    quartz_cron_expression = "0 0 * ? * *"
    timezone_id            = "JST"
  }
  warehouse_id = data.databricks_sql_warehouse.all.id
}

Expected Behavior

When we don't modify the configuration after the terraform apply command, the terraform plan should not find any change.

Actual Behavior

The terraform plan command shows a change for the pause_status field unexpectedly. Note that it is a read-only field according to the Databricks REST API documentation, and so we cannot specify it in the configuration.

$ terraform plan
...
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # databricks_quality_monitor.testTimeseriesMonitor will be updated in-place
  ~ resource "databricks_quality_monitor" "testTimeseriesMonitor" {
        id                         = "sandbox.things.bar"
        # (9 unchanged attributes hidden)

      ~ schedule {
          - pause_status           = "UNPAUSED" -> null
            # (2 unchanged attributes hidden)
        }

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
...

Steps to Reproduce

  1. terraform apply
  2. terraform plan

Terraform and provider versions

Terraform v1.8.3
on darwin_arm64
+ provider registry.terraform.io/databricks/databricks v1.47.0

Is it a regression?

No.

Debug Output

I don't think it's useful for the issue.

Important Factoids

No.

Would you like to implement a fix?

Yes.

touchida avatar Jun 23 '24 14:06 touchida