Closed rishabhtrivedi23 closed 1 year ago
provider = databricks.ws
should be provider = databricks.workspace
?
this is what I am defining while calling
module "workspace" { providers = { databricks.ac = databricks.accounts databricks.ws = databricks.workspace }
I can also see metastore assignment block in tfstate file as "tainted" and the metastore ID is missing.
"module": "module.workspace",
"mode": "managed",
"type": "databricks_metastore_assignment",
"name": "assignment",
"provider": "provider[\"registry.terraform.io/databricks/databricks\"].workspace",
"instances": [
{
"status": "**tainted**",
"schema_version": 0,
"attributes": {
"default_catalog_name": "hive_metastore",
"id": "<workspace_id>|<metastore_id>",
**"metastore_id": "",**
"workspace_id": <workspace_id>
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"module.workspace.databricks_mws_workspaces.workspace"
]
}
I also tried untaint but it didn't work.
This is resolved after updating provider.tf and using a workspace which is already added to metastore.
Configuration
Expected Behavior
It should have performed metastore assignment.
Terraform will perform the following actions:
module.workspace.databricks_metastore_assignment.assignment will be created
Actual Behavior
It fails at terraform level but performs metastore assignment at databricks account console level. module.workspace.databricks_metastore_assignment.assignment: Creating... ╷ │ Error: cannot read metastore assignment: No metastore assigned for the current workspace. │ │ with module.workspace.databricks_metastore_assignment.assignment, │ on ........\modules\databricks\buildworkspace\buildworkspace.tf line 61, in resource "databricks_metastore_assignment" "assignment": │ 61: resource "databricks_metastore_assignment" "assignment" { │
Steps to Reproduce
Terraform and provider versions
terraform version Terraform v1.4.6 on windows_amd64
Debug Output
Important Factoids
I have added debug output below :
module.workspace.databricks_metastore_assignment.assignment: Creating... 2023-06-06T07:57:34.092Z [INFO] Starting apply for module.workspace.databricks_metastore_assignment.assignment 2023-06-06T07:57:34.093Z [DEBUG] module.workspace.databricks_metastore_assignment.assignment: applying the planned Create change 2023-06-06T07:57:34.157Z [INFO] provider.terraform-provider-databricks_v1.17.0.exe: Using Google Default Application Credentials for Workspace: timestamp=2023-06-06T07:57:34.129Z 2023-06-06T07:57:35.222Z [DEBUG] provider.terraform-provider-databricks_v1.17.0.exe: PUT /api/2.1/unity-catalog/workspaces//metastore
Error: cannot read metastore assignment: No metastore assigned for the current workspace.
with module.workspace.databricks_metastore_assignment.assignment, on ........\modules\databricks\buildworkspace\buildworkspace.tf line 61, in resource "databricks_metastore_assignment" "assignment": 61: resource "databricks_metastore_assignment" "assignment" {
2023-06-06T07:57:36.177Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF" 2023-06-06T07:57:36.188Z [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/databricks/databricks/1.17.0/windows_amd64/terraform-provider-databricks_v1.17.0.exe pid=7608 2023-06-06T07:57:36.188Z [DEBUG] provider: plugin exited