1. Packages
  2. Databricks
  3. API Docs
  4. getClusterPolicy
Databricks v1.37.0 published on Thursday, Apr 25, 2024 by Pulumi

databricks.getClusterPolicy

Explore with Pulumi AI

databricks logo
Databricks v1.37.0 published on Thursday, Apr 25, 2024 by Pulumi

    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 dictionary

    The 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.
    IsDefault bool
    If true, policy is a default policy created and managed by Databricks.
    MaxClustersPerUser int
    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.
    PolicyFamilyDefinitionOverrides string
    Policy definition JSON document expressed in Databricks Policy Definition Language.
    PolicyFamilyId string
    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.
    IsDefault bool
    If true, policy is a default policy created and managed by Databricks.
    MaxClustersPerUser int
    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.
    PolicyFamilyDefinitionOverrides string
    Policy definition JSON document expressed in Databricks Policy Definition Language.
    PolicyFamilyId string
    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.
    isDefault Boolean
    If true, policy is a default policy created and managed by Databricks.
    maxClustersPerUser Integer
    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.
    policyFamilyDefinitionOverrides String
    Policy definition JSON document expressed in Databricks Policy Definition Language.
    policyFamilyId String
    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.
    isDefault boolean
    If true, policy is a default policy created and managed by Databricks.
    maxClustersPerUser number
    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.
    policyFamilyDefinitionOverrides string
    Policy definition JSON document expressed in Databricks Policy Definition Language.
    policyFamilyId string
    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_per_user int
    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_definition_overrides str
    Policy definition JSON document expressed in Databricks Policy Definition Language.
    policy_family_id str
    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.
    isDefault Boolean
    If true, policy is a default policy created and managed by Databricks.
    maxClustersPerUser Number
    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.
    policyFamilyDefinitionOverrides String
    Policy definition JSON document expressed in Databricks Policy Definition Language.
    policyFamilyId String
    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.
    IsDefault bool
    If true, policy is a default policy created and managed by Databricks.
    MaxClustersPerUser int
    Max number of clusters per user that can be active using this policy.
    Name string
    PolicyFamilyDefinitionOverrides string
    Policy definition JSON document expressed in Databricks Policy Definition Language.
    PolicyFamilyId string
    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.
    IsDefault bool
    If true, policy is a default policy created and managed by Databricks.
    MaxClustersPerUser int
    Max number of clusters per user that can be active using this policy.
    Name string
    PolicyFamilyDefinitionOverrides string
    Policy definition JSON document expressed in Databricks Policy Definition Language.
    PolicyFamilyId string
    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.
    isDefault Boolean
    If true, policy is a default policy created and managed by Databricks.
    maxClustersPerUser Integer
    Max number of clusters per user that can be active using this policy.
    name String
    policyFamilyDefinitionOverrides String
    Policy definition JSON document expressed in Databricks Policy Definition Language.
    policyFamilyId String
    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.
    isDefault boolean
    If true, policy is a default policy created and managed by Databricks.
    maxClustersPerUser number
    Max number of clusters per user that can be active using this policy.
    name string
    policyFamilyDefinitionOverrides string
    Policy definition JSON document expressed in Databricks Policy Definition Language.
    policyFamilyId string
    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_per_user int
    Max number of clusters per user that can be active using this policy.
    name str
    policy_family_definition_overrides str
    Policy definition JSON document expressed in Databricks Policy Definition Language.
    policy_family_id str
    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.
    isDefault Boolean
    If true, policy is a default policy created and managed by Databricks.
    maxClustersPerUser Number
    Max number of clusters per user that can be active using this policy.
    name String
    policyFamilyDefinitionOverrides String
    Policy definition JSON document expressed in Databricks Policy Definition Language.
    policyFamilyId String
    ID of the policy family.

    Package Details

    Repository
    databricks pulumi/pulumi-databricks
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the databricks Terraform Provider.
    databricks logo
    Databricks v1.37.0 published on Thursday, Apr 25, 2024 by Pulumi