Create any view using the databricks_sql_table resource which includes a column comment, and then change this comment and try to re-apply terraform.
resource "databricks_sql_table" "my_view" {
cluster_id = local.cluster_id
name = "view"
catalog_name = databricks_catalog.this.name
schema_name = databricks_schema.this.name
table_type = "VIEW"
view_definition = format("SELECT name FROM %s WHERE id == 1", databricks_sql_table.table.id)
comment = "A view managed by terraform"
column {
name = "name"
comment = "This comment is changed after the view is created"
}
}
Expected Behavior
When changing a column comment on a view and running terraform apply, the view would be successfully updated with the new comment.
Actual Behavior
When applying the change to a column comment, terraform tries to modify the resource and fails with an error like:
Error: cannot update sql table: cannot execute ALTER VIEW `my_catalog`.`my_schema`.`my_view` ALTER COLUMN `name` COMMENT 'An updated column comment.': [PARSE_SYNTAX_ERROR] Syntax error at or near 'ALTER'.(line 1, pos 72)
Steps to Reproduce
Define a view in terraform which includes a column comment and run terraform apply to create
This is partly a databricks issue, because you can't run ALTER VIEW at all - the same issue actually occurs if you try and edit column comments directly in the databricks UI. In the absence of databricks fixing this, would it be possible for the provider to be updated so that changes to column comments force replacement of views? There's no harm in replacing views, since they don't contain data so this would be safe to do, and would make it much easier to manage views with column comments using terraform. Currently we have to manually taint or delete views before applying whenever changing comments, which is quite frustrating
Configuration
Create any view using the
databricks_sql_table
resource which includes a column comment, and then change this comment and try to re-apply terraform.Expected Behavior
When changing a column comment on a view and running
terraform apply
, the view would be successfully updated with the new comment.Actual Behavior
When applying the change to a column comment, terraform tries to modify the resource and fails with an error like:
Steps to Reproduce
terraform apply
to createterraform apply
againTerraform and provider versions
Is it a regression?
No
Important Factoids
This is partly a databricks issue, because you can't run
ALTER VIEW
at all - the same issue actually occurs if you try and edit column comments directly in the databricks UI. In the absence of databricks fixing this, would it be possible for the provider to be updated so that changes to column comments force replacement of views? There's no harm in replacing views, since they don't contain data so this would be safe to do, and would make it much easier to manage views with column comments using terraform. Currently we have to manuallytaint
or delete views before applying whenever changing comments, which is quite frustrating