databricks.workspace points to a provider configuration interacting with the workspace API, using workspace created externally from the TF code. Let's call it Workspace Controldatabricks_mws_workspaces.this defines a workspace being managed, Workspace This.
databricks_metastore.metastore.id defines a metastore being managed.
Expected Behavior
When terraform plan is executed, the state should refresh and correctly mirror the actual resources.
Actual Behavior
When first applied, Workspace This is correctly associated to the metastore. However, subsequent refreshes of state, such as those when executing terraform plan, indicate that the association needs to be updated:
This seems to occur because of the API call used during read simply returns the metastore of the workspace associated with the databricks provider. If your provider is a different workspace than the one identified in the resource, it retrieves the wrong metastore id.
This occurs because the databricks provider is using a different workspace than the metastore assignment workspace being managed. The metastore for the workspace used by the provider is not the same as the one being associated in the terraform resource. The resource allows you to create these assignments, but then it doesn't correctly read the state afterwards. Moving this resource to use the account-level API would resolve this issue as there is no workspace-level API to read metastore assignments, only create, update and delete.
The
databricks_metastore_assignment
incorrectly refreshes state from the API.Configuration
databricks.workspace
points to a provider configuration interacting with the workspace API, using workspace created externally from the TF code. Let's call itWorkspace Control
databricks_mws_workspaces.this
defines a workspace being managed,Workspace This
.databricks_metastore.metastore.id
defines a metastore being managed.Expected Behavior
When
terraform plan
is executed, the state should refresh and correctly mirror the actual resources.Actual Behavior
When first applied,
Workspace This
is correctly associated to the metastore. However, subsequent refreshes of state, such as those when executingterraform plan
, indicate that the association needs to be updated:This seems to occur because of the API call used during read simply returns the metastore of the workspace associated with the databricks provider. If your provider is a different workspace than the one identified in the resource, it retrieves the wrong metastore id.
Steps to Reproduce
terraform plan
Terraform and provider versions
Debug Output
NA
Important Factoids
This occurs because the databricks provider is using a different workspace than the metastore assignment workspace being managed. The metastore for the workspace used by the provider is not the same as the one being associated in the terraform resource. The resource allows you to create these assignments, but then it doesn't correctly read the state afterwards. Moving this resource to use the account-level API would resolve this issue as there is no workspace-level API to read metastore assignments, only create, update and delete.