- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2024 10:51 AM - edited 07-13-2024 11:17 AM
Hi @JustLeo ,
You haven't provided how you defined resource, but maybe you're missing depends on clause?
According to terraform documentation:
In Terraform 0.13 and later, data resources have the same dependency resolution behavior as defined for managed resources. Most data resources make an API call to a workspace. If a workspace doesn't exist yet, default auth: cannot configure default credentials error is raised. To work around this issue and guarantee a proper lazy authentication with data resources, you should add depends_on = [azurerm_databricks_workspace.this] or depends_on = [databricks_mws_workspaces.this] to the body. This issue doesn't occur if a workspace is created in one module and resources within the workspace are created in another. We do not recommend using Terraform 0.12 and earlier if your usage involves data resources.
You can also compare your provider configuration to one below, which comes from official terraform guide. To create metastore and perform metastore assignment to workspace, they're using provider with an alias "accounts":
provider "databricks" {
host = local.databricks_workspace_host
}
provider "databricks" {
alias = "accounts"
host = "https://accounts.azuredatabricks.net"
account_id = var.databricks_account_id
}
You can also take a look on below thread with kind of similar problem: