Skip to content

Commit 474d8e3

Browse files
authored
Fixed creating workspaces with token {} block (#1002)
Fix #994
1 parent 878f555 commit 474d8e3

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

CHANGELOG.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
## 0.4.2
44

5+
* Added optional `auth_type` provider conf to enforce specific auth type to be used in very rare cases, where a single Terraform state manages Databricks workspaces on more than one cloud and `More than one authorization method configured` error is a false positive. Valid values are `pat`, `basic`, `azure-client-secret`, `azure-msi`, `azure-cli`, and `databricks-cli` ([#1000](https://github.com/databrickslabs/terraform-provider-databricks/pull/1000)).
56
* Added `DBC` format support for `databricks_notebook` ([#989](https://github.com/databrickslabs/terraform-provider-databricks/pull/989)).
6-
* Added optional `auth_type` provider conf to enforce specific auth type to be used in very rare cases, where a single Terraform state manages Databricks workspaces on more than one cloud and `More than one authorization method configured` error is a false positive. Valid values are `pat`, `basic`, `azure-client-secret`, `azure-msi`, `azure-cli`, and `databricks-cli`.
7-
* Added automated documentation formatting with `make fmt-docs`, so that all HCL examples look consistent.
8-
* Increased codebase unit test coverage to 91% to improve stability.
7+
* Fixed creating new `databricks_mws_workspaces` with `token {}` block ([#994](https://github.com/databrickslabs/terraform-provider-databricks/issues/994)).
8+
* Added automated documentation formatting with `make fmt-docs`, so that all HCL examples look consistent ([#999](https://github.com/databrickslabs/terraform-provider-databricks/pull/999)).
9+
* Increased codebase unit test coverage to 91% to improve stability ([#996](https://github.com/databrickslabs/terraform-provider-databricks/pull/996), [#992](https://github.com/databrickslabs/terraform-provider-databricks/pull/992), [#991](https://github.com/databrickslabs/terraform-provider-databricks/pull/991), [#990](https://github.com/databrickslabs/terraform-provider-databricks/pull/990)).
910

1011
Updated dependency versions:
1112

common/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ func (c *DatabricksClient) Authenticate(ctx context.Context) error {
260260
if authorizer == nil {
261261
continue
262262
}
263-
// even though this may complain about clear text loggin, passwords are replaced with `***`
263+
// even though this may complain about clear text logging, passwords are replaced with `***`
264264
log.Printf("[INFO] Configured %s auth: %s", auth.name, c.configDebugString()) // lgtm[go/clear-text-logging]
265265
c.authVisitor = authorizer
266266
c.AuthType = auth.name

mws/acceptance/workspace_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ func TestMwsAccWorkspaces(t *testing.T) {
5555
storage_configuration_id = databricks_mws_storage_configurations.this.storage_configuration_id
5656
managed_services_customer_managed_key_id = databricks_mws_customer_managed_keys.this.customer_managed_key_id
5757
network_id = databricks_mws_networks.this.network_id
58+
59+
token {
60+
comment = "Test {var.RANDOM}"
61+
}
5862
}`,
5963
},
6064
})

mws/resource_workspace.go

+6
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ func (a WorkspacesAPI) Create(ws *Workspace, timeout time.Duration) error {
144144
}
145145
return err
146146
}
147+
if ws.WorkspaceURL == "" {
148+
// WorkspaceURL is computed, yet very important field
149+
host := generateWorkspaceHostname(a.client, *ws)
150+
ws.WorkspaceURL = fmt.Sprintf("https://%s", host)
151+
}
147152
return nil
148153
}
149154

@@ -497,6 +502,7 @@ func ResourceWorkspace() *schema.Resource {
497502
return err
498503
}
499504
d.Set("workspace_id", workspace.WorkspaceID)
505+
d.Set("workspace_url", workspace.WorkspaceURL)
500506
p.Pack(d)
501507
return CreateTokenIfNeeded(workspacesAPI, workspaceSchema, d)
502508
},

0 commit comments

Comments
 (0)