Override default Personal Compute policy using terraform / disable Personal Compute policy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 03:44 AM
I want to programmatically do some adjustments to the default personal compute resource or preferably create my own custom one based on the same configuration or policy family (in which all users can gain access to) when deploying a new workspace using terraform. I know an account admin can enable Manage the Personal Compute policy - Azure Databricks | Microsoft Learn at an account level although I am uncertain if this can be applied for other policies too (for instance the custom one) so that the default is disabled and the custom one takes over.
Is there a way to override the defualt personal compute policy? I need the following to be overridden:
"autotermination_minutes": {
"type": "fixed",
"value": 30
}
This auto termination should be the default for all personal compute clusters in the workspace. Is there a way to make this work without having to manually adjust it post-deployment?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 04:32 AM
use api to create new cluster, set autotermination_minutes parameter
https://docs.databricks.com/api/workspace/clusters/create#autotermination_minutes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 04:44 AM
I am aware of the API. However, that is out of scope of the question as I want to configure a policy upon workspace creation using Terraform as opposed to creating a cluster. The policy should override the default configuration of the current default one shipped with databricks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 07:33 AM
Hi, I think this doc might be useful: Override default Personal Compute policy using ter... - Databricks - 61695, basically is an override process by creating a databricks_cluster_policy resource:
locals {
personal_vm_override = {
"autotermination_minutes" : {
"type" : "fixed",
"value" : 220,
"hidden" : true
},
"custom_tags.Team" : {
"type" : "fixed",
"value" : var.team
}
}
}
resource "databricks_cluster_policy" "personal_vm" {
policy_family_id = "personal-vm"
policy_family_definition_overrides = jsonencode(personal_vm_override)
name = "Personal Compute"
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2024 01:30 AM
Only way I got it working was by importing the pre-existing policy into terraform and do an overwrite as already mentioned by @jsimonovic . The full code example looks like this:
import {
id = "001BF0AC280610B4" # Polcy ID of the pre-existing personal compute policy
to = databricks_cluster_policy.personal_vm
}
resource "databricks_cluster_policy" "personal_vm" {
name = "Personal Compute"
policy_family_id = "personal-vm"
policy_family_definition_overrides = jsonencode({
autotermination_minutes = {
type = "fixed",
value = 30,
}
})
}

