Skip to content

Commit

Permalink
feat: cluster policies override
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonid_Frolov1 authored and Leonid_Frolov1 committed Sep 17, 2024
1 parent ab8ac0b commit 7eaaa06
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,14 @@ resource "databricks_cluster_policy" "this" {
name = each.key
definition = jsonencode(each.value)
}

resource "databricks_cluster_policy" "overrides" {
for_each = {
for param in var.default_cluster_policies_override : (param.name) => param
if param.definition != null
}

policy_family_id = each.value.family_id
policy_family_definition_overrides = jsonencode(each.value.definition)
name = each.key
}
19 changes: 19 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,22 @@ variable "system_schemas_enabled" {
description = "System Schemas only works with assigned Unity Catalog Metastore. Boolean flag to enabled this feature"
default = false
}

variable "default_cluster_policies_override" {
type = list(object({
name = string
family_id = string
definition = any
}))
description = <<-EOT
Provides an ability to override default cluster policy
name - name of cluster policy to override
family_id - family id of corresponding policy
definition - JSON document expressed in Databricks Policy Definition Language. No need to call 'jsonencode()' function on it when providing a value;
EOT
default = [{
name = null
family_id = null
definition = null
}]
}

0 comments on commit 7eaaa06

Please sign in to comment.