cluster_policies
Operations on a cluster_policies
resource.
Overview
Name | cluster_policies |
Type | Resource |
Id | databricks_workspace.compute.cluster_policies |
Fields
Name | Datatype |
---|---|
name | string |
description | string |
created_at_timestamp | integer |
creator_user_name | string |
definition | object |
is_default | boolean |
libraries | array |
max_clusters_per_user | integer |
policy_family_definition_overrides | object |
policy_family_id | string |
policy_id | string |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | policy_id, deployment_name | Get a cluster policy entity. Creation and editing is available to admins only. |
list | SELECT | deployment_name | Returns a list of policies accessible by the requesting user. |
create | INSERT | deployment_name | Creates a new policy with prescribed settings. |
delete | DELETE | deployment_name | Delete a policy for a cluster. Clusters governed by this policy can still run, but cannot be edited. |
edit | REPLACE | deployment_name | Update an existing policy for cluster. This operation may make some clusters governed by the previous policy invalid. |
SELECT
examples
- cluster_policies (list)
- cluster_policies (get)
SELECT
name,
description,
created_at_timestamp,
creator_user_name,
definition,
is_default,
libraries,
max_clusters_per_user,
policy_family_definition_overrides,
policy_family_id,
policy_id
FROM databricks_workspace.compute.cluster_policies
WHERE deployment_name = '{{ deployment_name }}';
SELECT
name,
description,
created_at_timestamp,
creator_user_name,
definition,
is_default,
libraries,
max_clusters_per_user,
policy_family_definition_overrides,
policy_family_id,
policy_id
FROM databricks_workspace.compute.cluster_policies
WHERE policy_id = '{{ policy_id }}' AND
deployment_name = '{{ deployment_name }}';
INSERT
example
Use the following StackQL query and manifest file to create a new cluster_policies
resource.
- cluster_policies
- Manifest
/*+ create */
INSERT INTO databricks_workspace.compute.cluster_policies (
deployment_name,
data__definition,
data__name
)
SELECT
'{{ deployment_name }}',
'{{ definition }}',
'{{ name }}'
;
- name: your_resource_model_name
props:
- name: definition
value: '{ "custom_tags.test_tag": { "type": "fixed", "value": "test_value" } }'
- name: name
value: Test policy
REPLACE
example
Replaces a cluster_policies
resource.
/*+ update */
-- replace field1, field2, etc. with the fields you want to update
REPLACE databricks_workspace.compute.cluster_policies
SET field1 = '{ value1 }',
field2 = '{ value2 }', ...
WHERE deployment_name = '{{ deployment_name }}';
DELETE
example
Deletes a cluster_policies
resource.
/*+ delete */
DELETE FROM databricks_workspace.compute.cluster_policies
WHERE deployment_name = '{{ deployment_name }}';