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_query` resource - perpetual diff on `run_as_mode` #4228

Closed apamildner closed 5 days ago

apamildner commented 1 week ago

Configuration

resource "databricks_query" "this" {
  warehouse_id = "some-id-123"
  query_text   = "SELECT FOO FROM BAR"
  display_name = "My query"
  parent_path  = "some/path"
  run_as_mode  = "viewer"
}

Expected Behavior

I expect the query to be created with the run_as_mode "viewer".

Actual Behavior

We get this

image

Steps to Reproduce

  1. terraform apply

Terraform and provider versions

Terraform v1.9.8
on darwin_arm64
+ provider registry.terraform.io/databricks/databricks v1.55.0

Is it a regression?

Not sure, just started using this one

Important Factoids

When I check the query in databricks under "Share", I see this:

image

Also it seems it is greyed out. Not sure who becomes the owner of the query when I create it via terraform either, as it seems a "principal" cannot be an owner of a query. From this

You must be a workspace admin to transfer ownership of a query. Service principals and groups cannot be assigned ownership of a query

Would you like to implement a fix?

I don't have capacity or knowledge for that sadly

alexott commented 1 week ago

Please attach the logs as described in the troubleshooting guide. Can you also try to specify VIEWER not viewer

apamildner commented 6 days ago

@alexott It was actually solved by explicitly writing VIEWER as suggested, good catch đź‘Ť I was not able to attach logs due to company policy, sorry about that.