Skip to content

Commit a279976

Browse files
committed
feat: iam refactor
1 parent 340b226 commit a279976

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

variables.tf

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,32 @@ variable "user_object_ids" {
1414
default = {}
1515
}
1616

17-
variable "iam" {
18-
type = map(object({
17+
variable "workspace_admins" {
18+
type = object({
1919
user = list(string)
2020
service_principal = list(string)
21-
}))
22-
description = "Map of groups and members of users and service principals to be created. You can add you own groups and members. E.g., `'group' = { user = ['user1','user2'] service_principal = ['sp1']}` and etc."
21+
})
22+
description = "Provide users or service principals to grant them Admin permissions."
2323
default = {
24-
"admins" = {
25-
"user" = []
26-
"service_principal" = []
27-
}
28-
"default" = {
29-
"user" = []
30-
"service_principal" = []
31-
}
24+
user = null
25+
service_principal = null
26+
}
27+
}
28+
29+
variable "iam" {
30+
type = map(object({
31+
user = optional(list(string))
32+
service_principal = optional(list(string))
33+
entitlements = optional(list(string))
34+
}))
35+
description = "Map of group name and its parameters, such as users and service principals whom are added to the group. Also group entitlements."
36+
default = {}
37+
38+
validation {
39+
condition = contains(values(var.iam), "entitlements") ? alltrue([
40+
for item in toset(flatten([for group, params in var.iam : params.entitlements])) : contains(["allow_cluster_create", "allow_instance_pool_create", "databricks_sql_access"], item)
41+
]) : true
42+
error_message = "Entitlements validation. The only suitable values are: databricks_sql_access, allow_instance_pool_create, allow_cluster_create"
3243
}
3344
}
3445

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
databricks = {
66
source = "databricks/databricks"
7-
version = ">=1.4.0"
7+
version = ">=1.9.0"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)