Databricks v1.46.0 published on Wednesday, Jun 26, 2024 by Pulumi
databricks.getClusterPolicy
Explore with Pulumi AI
Note If you have a fully automated setup with workspaces created by databricks_mws_workspaces, please make sure to add depends_on attribute in order to prevent default auth: cannot configure default credentials errors.
Retrieves information about databricks_cluster_policy.
Example Usage
Referring to a cluster policy by name:
import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";
const personal = databricks.getClusterPolicy({
    name: "Personal Compute",
});
const myCluster = new databricks.Cluster("my_cluster", {policyId: personal.then(personal => personal.id)});
import pulumi
import pulumi_databricks as databricks
personal = databricks.get_cluster_policy(name="Personal Compute")
my_cluster = databricks.Cluster("my_cluster", policy_id=personal.id)
package main
import (
	"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		personal, err := databricks.LookupClusterPolicy(ctx, &databricks.LookupClusterPolicyArgs{
			Name: pulumi.StringRef("Personal Compute"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = databricks.NewCluster(ctx, "my_cluster", &databricks.ClusterArgs{
			PolicyId: pulumi.String(personal.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Databricks = Pulumi.Databricks;
return await Deployment.RunAsync(() => 
{
    var personal = Databricks.GetClusterPolicy.Invoke(new()
    {
        Name = "Personal Compute",
    });
    var myCluster = new Databricks.Cluster("my_cluster", new()
    {
        PolicyId = personal.Apply(getClusterPolicyResult => getClusterPolicyResult.Id),
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.databricks.DatabricksFunctions;
import com.pulumi.databricks.inputs.GetClusterPolicyArgs;
import com.pulumi.databricks.Cluster;
import com.pulumi.databricks.ClusterArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var personal = DatabricksFunctions.getClusterPolicy(GetClusterPolicyArgs.builder()
            .name("Personal Compute")
            .build());
        var myCluster = new Cluster("myCluster", ClusterArgs.builder()
            .policyId(personal.applyValue(getClusterPolicyResult -> getClusterPolicyResult.id()))
            .build());
    }
}
resources:
  myCluster:
    type: databricks:Cluster
    name: my_cluster
    properties:
      policyId: ${personal.id}
variables:
  personal:
    fn::invoke:
      Function: databricks:getClusterPolicy
      Arguments:
        name: Personal Compute
Using getClusterPolicy
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getClusterPolicy(args: GetClusterPolicyArgs, opts?: InvokeOptions): Promise<GetClusterPolicyResult>
function getClusterPolicyOutput(args: GetClusterPolicyOutputArgs, opts?: InvokeOptions): Output<GetClusterPolicyResult>def get_cluster_policy(definition: Optional[str] = None,
                       description: Optional[str] = None,
                       id: Optional[str] = None,
                       is_default: Optional[bool] = None,
                       max_clusters_per_user: Optional[int] = None,
                       name: Optional[str] = None,
                       policy_family_definition_overrides: Optional[str] = None,
                       policy_family_id: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetClusterPolicyResult
def get_cluster_policy_output(definition: Optional[pulumi.Input[str]] = None,
                       description: Optional[pulumi.Input[str]] = None,
                       id: Optional[pulumi.Input[str]] = None,
                       is_default: Optional[pulumi.Input[bool]] = None,
                       max_clusters_per_user: Optional[pulumi.Input[int]] = None,
                       name: Optional[pulumi.Input[str]] = None,
                       policy_family_definition_overrides: Optional[pulumi.Input[str]] = None,
                       policy_family_id: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetClusterPolicyResult]func LookupClusterPolicy(ctx *Context, args *LookupClusterPolicyArgs, opts ...InvokeOption) (*LookupClusterPolicyResult, error)
func LookupClusterPolicyOutput(ctx *Context, args *LookupClusterPolicyOutputArgs, opts ...InvokeOption) LookupClusterPolicyResultOutput> Note: This function is named LookupClusterPolicy in the Go SDK.
public static class GetClusterPolicy 
{
    public static Task<GetClusterPolicyResult> InvokeAsync(GetClusterPolicyArgs args, InvokeOptions? opts = null)
    public static Output<GetClusterPolicyResult> Invoke(GetClusterPolicyInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetClusterPolicyResult> getClusterPolicy(GetClusterPolicyArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: databricks:index/getClusterPolicy:getClusterPolicy
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Definition string
 - Policy definition: JSON document expressed in Databricks Policy Definition Language.
 - Description string
 - Additional human-readable description of the cluster policy.
 - Id string
 - The id of the cluster policy.
 - Is
Default bool - If true, policy is a default policy created and managed by Databricks.
 - Max
Clusters intPer User  - Max number of clusters per user that can be active using this policy.
 - Name string
 - Name of the cluster policy. The cluster policy must exist before this resource can be planned.
 - Policy
Family stringDefinition Overrides  - Policy definition JSON document expressed in Databricks Policy Definition Language.
 - Policy
Family stringId  - ID of the policy family.
 
- Definition string
 - Policy definition: JSON document expressed in Databricks Policy Definition Language.
 - Description string
 - Additional human-readable description of the cluster policy.
 - Id string
 - The id of the cluster policy.
 - Is
Default bool - If true, policy is a default policy created and managed by Databricks.
 - Max
Clusters intPer User  - Max number of clusters per user that can be active using this policy.
 - Name string
 - Name of the cluster policy. The cluster policy must exist before this resource can be planned.
 - Policy
Family stringDefinition Overrides  - Policy definition JSON document expressed in Databricks Policy Definition Language.
 - Policy
Family stringId  - ID of the policy family.
 
- definition String
 - Policy definition: JSON document expressed in Databricks Policy Definition Language.
 - description String
 - Additional human-readable description of the cluster policy.
 - id String
 - The id of the cluster policy.
 - is
Default Boolean - If true, policy is a default policy created and managed by Databricks.
 - max
Clusters IntegerPer User  - Max number of clusters per user that can be active using this policy.
 - name String
 - Name of the cluster policy. The cluster policy must exist before this resource can be planned.
 - policy
Family StringDefinition Overrides  - Policy definition JSON document expressed in Databricks Policy Definition Language.
 - policy
Family StringId  - ID of the policy family.
 
- definition string
 - Policy definition: JSON document expressed in Databricks Policy Definition Language.
 - description string
 - Additional human-readable description of the cluster policy.
 - id string
 - The id of the cluster policy.
 - is
Default boolean - If true, policy is a default policy created and managed by Databricks.
 - max
Clusters numberPer User  - Max number of clusters per user that can be active using this policy.
 - name string
 - Name of the cluster policy. The cluster policy must exist before this resource can be planned.
 - policy
Family stringDefinition Overrides  - Policy definition JSON document expressed in Databricks Policy Definition Language.
 - policy
Family stringId  - ID of the policy family.
 
- definition str
 - Policy definition: JSON document expressed in Databricks Policy Definition Language.
 - description str
 - Additional human-readable description of the cluster policy.
 - id str
 - The id of the cluster policy.
 - is_
default bool - If true, policy is a default policy created and managed by Databricks.
 - max_
clusters_ intper_ user  - Max number of clusters per user that can be active using this policy.
 - name str
 - Name of the cluster policy. The cluster policy must exist before this resource can be planned.
 - policy_
family_ strdefinition_ overrides  - Policy definition JSON document expressed in Databricks Policy Definition Language.
 - policy_
family_ strid  - ID of the policy family.
 
- definition String
 - Policy definition: JSON document expressed in Databricks Policy Definition Language.
 - description String
 - Additional human-readable description of the cluster policy.
 - id String
 - The id of the cluster policy.
 - is
Default Boolean - If true, policy is a default policy created and managed by Databricks.
 - max
Clusters NumberPer User  - Max number of clusters per user that can be active using this policy.
 - name String
 - Name of the cluster policy. The cluster policy must exist before this resource can be planned.
 - policy
Family StringDefinition Overrides  - Policy definition JSON document expressed in Databricks Policy Definition Language.
 - policy
Family StringId  - ID of the policy family.
 
getClusterPolicy Result
The following output properties are available:
- Definition string
 - Policy definition: JSON document expressed in Databricks Policy Definition Language.
 - Description string
 - Additional human-readable description of the cluster policy.
 - Id string
 - The id of the cluster policy.
 - Is
Default bool - If true, policy is a default policy created and managed by Databricks.
 - Max
Clusters intPer User  - Max number of clusters per user that can be active using this policy.
 - Name string
 - Policy
Family stringDefinition Overrides  - Policy definition JSON document expressed in Databricks Policy Definition Language.
 - Policy
Family stringId  - ID of the policy family.
 
- Definition string
 - Policy definition: JSON document expressed in Databricks Policy Definition Language.
 - Description string
 - Additional human-readable description of the cluster policy.
 - Id string
 - The id of the cluster policy.
 - Is
Default bool - If true, policy is a default policy created and managed by Databricks.
 - Max
Clusters intPer User  - Max number of clusters per user that can be active using this policy.
 - Name string
 - Policy
Family stringDefinition Overrides  - Policy definition JSON document expressed in Databricks Policy Definition Language.
 - Policy
Family stringId  - ID of the policy family.
 
- definition String
 - Policy definition: JSON document expressed in Databricks Policy Definition Language.
 - description String
 - Additional human-readable description of the cluster policy.
 - id String
 - The id of the cluster policy.
 - is
Default Boolean - If true, policy is a default policy created and managed by Databricks.
 - max
Clusters IntegerPer User  - Max number of clusters per user that can be active using this policy.
 - name String
 - policy
Family StringDefinition Overrides  - Policy definition JSON document expressed in Databricks Policy Definition Language.
 - policy
Family StringId  - ID of the policy family.
 
- definition string
 - Policy definition: JSON document expressed in Databricks Policy Definition Language.
 - description string
 - Additional human-readable description of the cluster policy.
 - id string
 - The id of the cluster policy.
 - is
Default boolean - If true, policy is a default policy created and managed by Databricks.
 - max
Clusters numberPer User  - Max number of clusters per user that can be active using this policy.
 - name string
 - policy
Family stringDefinition Overrides  - Policy definition JSON document expressed in Databricks Policy Definition Language.
 - policy
Family stringId  - ID of the policy family.
 
- definition str
 - Policy definition: JSON document expressed in Databricks Policy Definition Language.
 - description str
 - Additional human-readable description of the cluster policy.
 - id str
 - The id of the cluster policy.
 - is_
default bool - If true, policy is a default policy created and managed by Databricks.
 - max_
clusters_ intper_ user  - Max number of clusters per user that can be active using this policy.
 - name str
 - policy_
family_ strdefinition_ overrides  - Policy definition JSON document expressed in Databricks Policy Definition Language.
 - policy_
family_ strid  - ID of the policy family.
 
- definition String
 - Policy definition: JSON document expressed in Databricks Policy Definition Language.
 - description String
 - Additional human-readable description of the cluster policy.
 - id String
 - The id of the cluster policy.
 - is
Default Boolean - If true, policy is a default policy created and managed by Databricks.
 - max
Clusters NumberPer User  - Max number of clusters per user that can be active using this policy.
 - name String
 - policy
Family StringDefinition Overrides  - Policy definition JSON document expressed in Databricks Policy Definition Language.
 - policy
Family StringId  - ID of the policy family.
 
Package Details
- Repository
 - databricks pulumi/pulumi-databricks
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
databricksTerraform Provider.