Problem
When you try to deploy a Databricks workspace using Terraform, it fails with an error message.
"Error: cannot create mws permission assignment: Permission assignment APIs are not available for this workspace."
Cause
The group assignment to the workspace occurs before the metastore assignment to the workspace. When Terraform tries to assign the group to the workspace using an identity federation API from the account console, the error occurs because the workspace has not been identity-federated yet.
Solution
Add a depends_on
clause to the failing workspace resource or modules. This clause ensures the metastore assignment to the workspace is complete before attempting to assign the group to the workspace.
Example
```terraform
resource "databricks_mws_permission_assignment" "dev_group" {
depends_on = [
databricks_metastore_assignment.<your-metastore-assignment>
]
}
```
Additionally, setting a sleep time after the metastore assignment can help with dependency issues.