@@ -61,43 +61,22 @@ variable "iam" {
6161  }
6262}
6363
64- #  Default Cluster and Cluster Policy variables
65- variable  "default_cluster_id"  {
66-   type         =  map (string )
67-   description  =  " Single value of default Cluster id created by 'databricks-runtime' module" 
68-   default      =  
69- }
70- 
71- variable  "cluster_policies_object"  {
72-   type  =  list (object ({
73-     id      =  string 
74-     name    =  string 
75-     can_use =  list (string )
76-   }))
77-   description  =  " List of objects that provides an ability to grant custom workspace group a permission to use(CAN_USE) cluster policy" 
78-   default  =  
79-     id      =  null 
80-     name    =  null 
81-     can_use =  null 
82-   }]
83- }
84- 
8564#  SQL Endpoint variables
8665variable  "sql_endpoint"  {
8766  type  =  set (object ({
8867    name                      =  string 
89-     cluster_size              =  optional (string )
90-     min_num_clusters          =  optional (number )
91-     max_num_clusters          =  optional (number )
92-     auto_stop_mins            =  optional (string )
93-     enable_photon             =  optional (bool )
94-     enable_serverless_compute =  optional (bool )
95-     spot_instance_policy      =  optional (string )
96-     warehouse_type            =  optional (string )
68+     cluster_size              =  optional (string ,  " 2X-Small " 
69+     min_num_clusters          =  optional (number ,  0 )
70+     max_num_clusters          =  optional (number ,  1 )
71+     auto_stop_mins            =  optional (string ,  " 30 " 
72+     enable_photon             =  optional (bool ,  false )
73+     enable_serverless_compute =  optional (bool ,  false )
74+     spot_instance_policy      =  optional (string ,  " COST_OPTIMIZED " 
75+     warehouse_type            =  optional (string ,  " PRO " 
9776    permissions =  optional (set (object ({
9877      group_name       =  string 
9978      permission_level =  string 
100-     })))
79+     })), [] )
10180  }))
10281  description  =  " Set of objects with parameters to configure SQL Endpoint and assign permissions to it for certain custom groups" 
10382  default      =  
254233  }]
255234}
256235
257- variable  "sku"  {
258-   type         =  string 
259-   description  =  " The sku to use for the Databricks Workspace: [standard|premium|trial]" 
260-   default      =  " premium" 
261- }
262- 
263236variable  "key_vault_id"  {
264237  type         =  string 
265238  description  =  " ID of the Key Vault instance where the Secret resides" 
@@ -277,4 +250,54 @@ variable "mountpoints" {
277250  }))
278251  description  =  " Mountpoints for databricks" 
279252  default      =  
280- }
253+ }
254+ 
255+ variable  "custom_cluster_policies"  {
256+   type  =  list (object ({
257+     name       =  string 
258+     can_use    =  list (string )
259+     definition =  any 
260+     assigned   =  bool 
261+   }))
262+   description  =  <<- EOT 
263+ Provides an ability to create custom cluster policy, assign it to cluster and grant CAN_USE permissions on it to certain custom groups 
264+ name - name of custom cluster policy to create 
265+ can_use - list of string, where values are custom group names, there groups have to be created with Terraform; 
266+ definition - JSON document expressed in Databricks Policy Definition Language. No need to call 'jsonencode()' function on it when providing a value; 
267+ assigned - boolean flag which assigns policy to default 'shared autoscaling' cluster, only single custom policy could be assigned; 
268+ EOT 
269+   default  =  
270+     name       =  null 
271+     can_use    =  null 
272+     definition =  null 
273+     assigned   =  false 
274+   }]
275+   validation  {
276+     condition      =  length ([for  policy  in  var . custom_cluster_policies  :  policy . assigned  if  policy . assigned ]) <=  1 
277+     error_message  =  " Only single cluster policy assignment allowed. Please set 'assigned' parameter to 'true' for exact one or none policy" 
278+   }
279+ }
280+ 
281+ variable  "clusters"  {
282+   type  =  set (object ({
283+     cluster_name                 =  string 
284+     spark_version                =  optional (string , " 11.3.x-scala2.12" 
285+     spark_conf                   =  optional (map (any ), {})
286+     spark_env_vars               =  optional (map (any ), {})
287+     data_security_mode           =  optional (string , " USER_ISOLATION" 
288+     node_type_id                 =  optional (string , " Standard_D3_v2" 
289+     autotermination_minutes      =  optional (number , 30 )
290+     min_workers                  =  optional (number , 1 )
291+     max_workers                  =  optional (number , 2 )
292+     availability                 =  optional (string , " ON_DEMAND_AZURE" 
293+     first_on_demand              =  optional (number , 0 )
294+     spot_bid_max_price           =  optional (number , 1 )
295+     cluster_log_conf_destination =  optional (string , null )
296+     permissions =  optional (set (object ({
297+       group_name       =  string 
298+       permission_level =  string 
299+     })), [])
300+   }))
301+   description  =  " Set of objects with parameters to configure Databricks clusters and assign permissions to it for certain custom groups" 
302+   default      =  
303+ }
0 commit comments