Skip to content

Commit 50b6416

Browse files
committed
Clarified error messages around azure_workspace_resource_id
Fixed #1049
1 parent 9bd9112 commit 50b6416

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Version changelog
22

3+
## 0.4.6
4+
5+
* Clarified error messages around `azure_workspace_resource_id` provider configuration ([#1049](https://github.com/databrickslabs/terraform-provider-databricks/issues/1049)).
6+
37
## 0.4.5
48

59
* Cross-linked resource documentation ([#1027](https://github.com/databrickslabs/terraform-provider-databricks/pull/1027)).

common/azure_auth.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func (aa *DatabricksClient) ensureWorkspaceURL(ctx context.Context,
185185
}
186186
resourceID := aa.AzureResourceID
187187
if resourceID == "" {
188-
return fmt.Errorf("somehow resource id is not set")
188+
return fmt.Errorf("please set `azure_workspace_resource_id` provider argument")
189189
}
190190
log.Println("[DEBUG] Getting Workspace ID via management token.")
191191
// All azure endpoints typically end with a trailing slash removing it because resourceID starts with slash

common/azure_auth_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func TestEnsureWorkspaceURL_CornerCases(t *testing.T) {
9090
aa.AzureEnvironment = &env
9191

9292
err = aa.ensureWorkspaceURL(context.Background(), nil)
93-
assert.EqualError(t, err, "somehow resource id is not set")
93+
assert.EqualError(t, err, "please set `azure_workspace_resource_id` provider argument")
9494
}
9595

9696
func TestDatabricksClient_ensureWorkspaceURL(t *testing.T) {
@@ -517,7 +517,7 @@ func TestSimpleAADRequestVisitor_FailWorkspaceUrl(t *testing.T) {
517517
func(resource string) (autorest.Authorizer, error) {
518518
return autorest.NullAuthorizer{}, nil
519519
})
520-
assert.EqualError(t, err, "cannot get workspace: somehow resource id is not set")
520+
assert.EqualError(t, err, "cannot get workspace: please set `azure_workspace_resource_id` provider argument")
521521
}
522522

523523
func TestSimpleAADRequestVisitor_FailPlatformAuth(t *testing.T) {

docs/index.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ Since v0.3.8, it's possible to leverage [Azure Managed Service Identity](https:/
188188

189189
```hcl
190190
provider "databricks" {
191-
host = data.azurerm_databricks_workspace.this.workspace_url
191+
host = data.azurerm_databricks_workspace.this.workspace_url
192+
azure_workspace_resource_id = azurerm_databricks_workspace.this.id
192193
193194
# ARM_USE_MSI environment variable is recommended
194195
azure_use_msi = true
@@ -239,18 +240,19 @@ resource "azurerm_databricks_workspace" "this" {
239240
}
240241
241242
provider "databricks" {
242-
host = azurerm_databricks_workspace.this.workspace_url
243-
azure_client_id = var.client_id
244-
azure_client_secret = var.client_secret
245-
azure_tenant_id = var.tenant_id
243+
host = azurerm_databricks_workspace.this.workspace_url
244+
azure_workspace_resource_id = azurerm_databricks_workspace.this.id
245+
azure_client_id = var.client_id
246+
azure_client_secret = var.client_secret
247+
azure_tenant_id = var.tenant_id
246248
}
247249
248250
resource "databricks_user" "my-user" {
249251
user_name = "[email protected]"
250252
}
251253
```
252254

253-
* `azure_workspace_resource_id` - (optional) `id` attribute of [azurerm_databricks_workspace](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/databricks_workspace) resource. Combination of subscription id, resource group name, and workspace name.
255+
* `azure_workspace_resource_id` - (optional) `id` attribute of [azurerm_databricks_workspace](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/databricks_workspace) resource. Combination of subscription id, resource group name, and workspace name. Required with `auzre_use_msi` or `azure_client_secret`.
254256
* `azure_client_secret` - (optional) This is the Azure Enterprise Application (Service principal) client secret. This service principal requires contributor access to your Azure Databricks deployment. Alternatively, you can provide this value as an environment variable `ARM_CLIENT_SECRET`.
255257
* `azure_client_id` - (optional) This is the Azure Enterprise Application (Service principal) client id. This service principal requires contributor access to your Azure Databricks deployment. Alternatively, you can provide this value as an environment variable `ARM_CLIENT_ID`.
256258
* `azure_tenant_id` - (optional) This is the Azure Active Directory Tenant id in which the Enterprise Application (Service Principal)

docs/resources/sql_global_config.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ For Azure you should use the `data_access_config` to provide the service princip
2525

2626
```hcl
2727
resource "databricks_sql_global_config" "this" {
28-
security_policy = "DATA_ACCESS_CONTROL"
28+
security_policy = "DATA_ACCESS_CONTROL"
2929
data_access_config = {
3030
"spark.hadoop.fs.azure.account.auth.type" : "OAuth",
3131
"spark.hadoop.fs.azure.account.oauth.provider.type" : "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider",

0 commit comments

Comments
 (0)