Skip to content

Commit 241aae5

Browse files
authored
Added support to create databricks_user on the account level (#849)
1 parent 0649acf commit 241aae5

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
* Added `databricks_repo` resource to manage [Databricks Repos](https://docs.databricks.com/repos.html) ([#771](https://github.com/databrickslabs/terraform-provider-databricks/pull/771))
66
* Added support for Azure MSI authentication ([#743](https://github.com/databrickslabs/terraform-provider-databricks/pull/743))
7+
* Added support to create `databricks_user` on the account level ([#818](https://github.com/databrickslabs/terraform-provider-databricks/issues/818))
78
* Already deleted `databricks_token` don't fail the apply ([#808](https://github.com/databrickslabs/terraform-provider-databricks/pull/808))
89
* Default `terraform-mount` clusters created for mounting for `databricks_aws_s3_mount`, `databricks_azure_adls_gen1_mount`, `databricks_azure_adls_gen2_mount`, and `databricks_azure_blob_mount` have now `spark.scheduler.mode` as `FIFO` ([#828](https://github.com/databrickslabs/terraform-provider-databricks/pull/828))
910
* Fixed crash when using non-Azure authentication to mount Azure resources ([#831](https://github.com/databrickslabs/terraform-provider-databricks/issues/831))

common/http.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ func (c *DatabricksClient) api12(r *http.Request) error {
336336
func (c *DatabricksClient) Scim(ctx context.Context, method, path string, request interface{}, response interface{}) error {
337337
body, err := c.authenticatedQuery(ctx, method, path, request, c.api2, func(r *http.Request) error {
338338
r.Header.Set("Content-Type", "application/scim+json")
339+
if c.isAccountsClient() && c.AccountID != "" {
340+
// until `/preview` is there for workspace scim
341+
r.URL.Path = strings.ReplaceAll(path, "/preview", fmt.Sprintf("/api/2.0/accounts/%s", c.AccountID))
342+
}
339343
return nil
340344
})
341345
if err != nil {

docs/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ Alternatively, you can provide this value as an environment variable `DATABRICKS
174174
* `config_file` - (optional) Location of the Databricks CLI credentials file created by `databricks configure --token` command (~/.databrickscfg by default). Check [Databricks CLI documentation](https://docs.databricks.com/dev-tools/cli/index.html#set-up-authentication) for more details. The provider uses configuration file credentials when you don't specify host/token/username/password/azure attributes. Alternatively, you can provide this value as an environment variable `DATABRICKS_CONFIG_FILE`. This field defaults to `~/.databrickscfg`.
175175
* `profile` - (optional) Connection profile specified within ~/.databrickscfg. Please check [connection profiles section](https://docs.databricks.com/dev-tools/cli/index.html#connection-profiles) for more details. This field defaults to
176176
`DEFAULT`.
177+
* `account_id` - (optional) Account Id that could be found in the bottom left corner of [Accounts Console](https://accounts.cloud.databricks.com/). Alternatively, you can provide this value as an environment variable `DATABRICKS_ACCOUNT_ID`. Only has effect when `host = "https://accounts.cloud.databricks.com/"` and currently used to provision account admins via [databricks_user](resources/user.md). In the future releases of the provider this property will also be used specify account for `databricks_mws_*` resources as well.
177178

178179
## Special configurations for Azure
179180

@@ -283,6 +284,7 @@ The following configuration attributes can be passed via environment variables:
283284
| `token` | `DATABRICKS_TOKEN` |
284285
| `username` | `DATABRICKS_USERNAME` |
285286
| `password` | `DATABRICKS_PASSWORD` |
287+
| `account_id` | `DATABRICKS_ACCOUNT_ID` |
286288
| `config_file` | `DATABRICKS_CONFIG_FILE` |
287289
| `profile` | `DATABRICKS_CONFIG_PROFILE` |
288290
| `azure_client_secret` | `ARM_CLIENT_SECRET` |

0 commit comments

Comments
 (0)