- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2022 08:37 AM
I got the same error
Error: cannot create metastore data access: No metastore assigned for the current workspace.
and fixed it by reversing the depends_on order. I am now making databricks_metastore_data_access depend on databricks_metastore_assignment. Here is my code:
resource "databricks_metastore" "this" {
provider = databricks.workspace
name = "${var.prefix}-metastore"
storage_root = "s3://${aws_s3_bucket.metastore.id}/metastore"
delta_sharing_scope = "INTERNAL"
delta_sharing_recipient_token_lifetime_in_seconds = 120
force_destroy = true
}
// Assign the metastore to workspaces
resource "databricks_metastore_assignment" "this" {
provider = databricks.workspace
count = length(var.workspaces)
metastore_id = databricks_metastore.this.id
workspace_id = tonumber(replace(var.workspaces[count.index], "/.*//", ""))
depends_on = [ databricks_metastore.this ]
}
resource "databricks_metastore_data_access" "metastore_data_access" {
provider = databricks.workspace
metastore_id = databricks_metastore.this.id
name = aws_iam_role.metastore_data_access.name
aws_iam_role { role_arn = aws_iam_role.metastore_data_access.arn }
is_default = true
depends_on = [ databricks_metastore_assignment.this ]
}