cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Can Terraform be used to set configurations in Admin / workspace settings?

nicole_wong
New Contributor II

I am posting this on behalf of my customer. They are currently working on the deployment & config of their workspace on AWS via Terraform.

Is it possible to set some configs in the Admin/workspace settings via TF? According to the Terraform module, it isn’t.

https://registry.terraform.io/providers/databrickslabs/databricks/latest/docs/resources/workspace_co...

The config settings we would like to automate are:

  • Access Control
    • enable Table access control
  •  Configure Personal Access Tokens to grant all users Can use access
  • Cluster
    • enable Cluster Container Services
    • enable EBS SSD gp3
  • Advanced
    • enable Web terminal
    • enable DBFS file browser

1 ACCEPTED SOLUTION

Accepted Solutions

maiconbaum
New Contributor III

I had the same problem and couldn't find this anywhere, except in the source code for databricks-cli at PowerShell:

https://www.powershellgallery.com/packages/DatabricksPS/1.11.0.8/Content/Public%5CWorkspaceConfig.ps...

Hope this helps someone else too.

View solution in original post

10 REPLIES 10

nicole_wong
New Contributor II

Hi @Kaniz Fatma​ ! Following up on this question for my customer. I just recently learned that all of the config settings mentioned above can be accessed via our APIs. I'm not very familiar with Terraform, what additional information would be needed to enable TF to set those configurations via the APIs? Is this possible?

Thanks!

Ravi
Databricks Employee
Databricks Employee

Hi @Nicole Wong​ , can you try below options:

resource "databricks_permissions" "token_usage" {
    authorization = "tokens"
 
    access_control {
        group_name = "<groupname>"
        permission_level = "CAN_USE"
    }
}
  • Cluster
    • enable Cluster Container Services can be enabled via "enableDcs" custom_config
    • enable EBS SSD gp3 can be enabled via "enableGp3" custom_config
  • Advanced
    • enable Web terminal can be enabled via "enableWebTerminal" custom_config
    • enable DBFS file browser can be enabled via "enableDbfsFileBrowser" custom_config
resource "databricks_workspace_conf" "this" {
  custom_config = {
    "enableWebTerminal" : true,
    "enableGp3" : true,
    "enableDbfsFileBrowser" : true,
    "enableDcs" : true
  }
}

To achieve the same via API we can use below curl:

curl --location --request PATCH 'https://test.cloud.databricks.com/api/2.0/workspace-conf' \
--header 'Authorization: Bearer REPLACE_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "enableWebTerminal": "true",
    "enableGp3": "true",
    "enableDbfsFileBrowser": "true",
    "enableDcs": "true"
}'

Ricardo_Gaspar
New Contributor III

Thanks @Ravirahul Padmanabhan​ we are going to try it out and come back to you if there are any questions.

jose_gonzalez
Databricks Employee
Databricks Employee

Hi @Ricardo Gaspar​ ,

Did Ravi's fully answered your question, would you be happy to mark their answer as best so that others can quickly find the solution?

@Jose Gonzalez​  @Ravirahul Padmanabhan​ 

It doesn't solve all the requested permissions. But this already helps for now.

Would you be able to add that example terraform to the terraform provider documentation? or is there any webpage that lists all the existing customizable configs?

It certainly would be better to be able to control this via Terraform.

Vaaceph
New Contributor II

Any update for "enable Table access control" from TF?

Ravi
Databricks Employee
Databricks Employee

"Table access control" workspace config is not supported via Databricks Terraform provider.

Vaaceph
New Contributor II

okay. that is sad 😞

francly
New Contributor II

Hi, can I get a full list of the latest configurable supported workspace_conf on tf, I can't find the list on tf registry site.

maiconbaum
New Contributor III

I had the same problem and couldn't find this anywhere, except in the source code for databricks-cli at PowerShell:

https://www.powershellgallery.com/packages/DatabricksPS/1.11.0.8/Content/Public%5CWorkspaceConfig.ps...

Hope this helps someone else too.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group