Skip to content

Commit c8a3910

Browse files
committed
feat: secret scope acls
1 parent 0c26bc8 commit c8a3910

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

permissions.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
locals {
2+
secrets_acl_objects_list = flatten([for param in var.secret_scope_object : [
3+
for permission in param.acl : {
4+
scope = param.scope_name, principal = permission.principal, permission = permission.permission
5+
}] if param.acl != null
6+
])
7+
}
8+
19
resource "databricks_permissions" "default_cluster" {
210
for_each = length(var.default_cluster_id) == 0 ? {} : {
311
for k, v in var.iam : k => v.default_cluster_permission
@@ -46,3 +54,11 @@ resource "databricks_permissions" "sql_endpoint" {
4654

4755
depends_on = [databricks_group.this]
4856
}
57+
58+
resource "databricks_secret_acl" "this" {
59+
for_each = { for entry in local.secrets_acl_objects_list : "${entry.scope}.${entry.principal}.${entry.permission}" => entry }
60+
61+
scope = each.value.scope
62+
principal = databricks_group.this[each.value.principal].display_name
63+
permission = each.value.permission
64+
}

variables.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,19 @@ variable "metastore_grants" {
197197
error_message = "Metastore permission validation. The only possible values for permissions are: CREATE_CATALOG, CREATE_EXTERNAL_LOCATION, CREATE_SHARE, CREATE_RECIPIENT, CREATE_PROVIDER"
198198
}
199199
}
200+
201+
# Secret Scope ACLs variables
202+
variable "secret_scope_object" {
203+
type = list(object({
204+
scope_name = string
205+
acl = list(object({
206+
principal = string
207+
permission = string
208+
}))
209+
}))
210+
description = "List of objects, where 'scope_name' param is a Secret scope name and 'acl' are list of objects with 'principals' and one of allowed 'permission' ('READ', 'WRITE' or 'MANAGE')"
211+
default = [{
212+
scope_name = null
213+
acl = null
214+
}]
215+
}

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ terraform {
88
}
99
databricks = {
1010
source = "databricks/databricks"
11-
version = ">=1.9.0"
11+
version = ">=1.9.2"
1212
}
1313
}
1414
}

0 commit comments

Comments
 (0)