1. Packages
  2. Databricks
  3. API Docs
  4. getClusters
Databricks v1.56.0 published on Tuesday, Nov 12, 2024 by Pulumi

databricks.getClusters

Explore with Pulumi AI

databricks logo
Databricks v1.56.0 published on Tuesday, Nov 12, 2024 by Pulumi

    Note If you have a fully automated setup with workspaces created by databricks.MwsWorkspaces or azurerm_databricks_workspace, please make sure to add depends_on attribute in order to prevent default auth: cannot configure default credentials errors.

    Retrieves a list of databricks.Cluster ids, that were created by Pulumi or manually, with or without databricks_cluster_policy.

    Example Usage

    Retrieve cluster IDs for all clusters:

    import * as pulumi from "@pulumi/pulumi";
    import * as databricks from "@pulumi/databricks";
    
    const all = databricks.getClusters({});
    
    import pulumi
    import pulumi_databricks as databricks
    
    all = databricks.get_clusters()
    
    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 {
    		_, err := databricks.GetClusters(ctx, &databricks.GetClustersArgs{}, nil)
    		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 all = Databricks.GetClusters.Invoke();
    
    });
    
    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.GetClustersArgs;
    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 all = DatabricksFunctions.getClusters();
    
        }
    }
    
    variables:
      all:
        fn::invoke:
          Function: databricks:getClusters
          Arguments: {}
    

    Retrieve cluster IDs for all clusters having “Shared” in the cluster name:

    import * as pulumi from "@pulumi/pulumi";
    import * as databricks from "@pulumi/databricks";
    
    const allShared = databricks.getClusters({
        clusterNameContains: "shared",
    });
    
    import pulumi
    import pulumi_databricks as databricks
    
    all_shared = databricks.get_clusters(cluster_name_contains="shared")
    
    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 {
    		_, err := databricks.GetClusters(ctx, &databricks.GetClustersArgs{
    			ClusterNameContains: pulumi.StringRef("shared"),
    		}, nil)
    		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 allShared = Databricks.GetClusters.Invoke(new()
        {
            ClusterNameContains = "shared",
        });
    
    });
    
    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.GetClustersArgs;
    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 allShared = DatabricksFunctions.getClusters(GetClustersArgs.builder()
                .clusterNameContains("shared")
                .build());
    
        }
    }
    
    variables:
      allShared:
        fn::invoke:
          Function: databricks:getClusters
          Arguments:
            clusterNameContains: shared
    

    The following resources are used in the same context:

    • End to end workspace management guide.
    • databricks.Cluster to create Databricks Clusters.
    • databricks.ClusterPolicy to create a databricks.Cluster policy, which limits the ability to create clusters based on a set of rules.
    • databricks.InstancePool to manage instance pools to reduce cluster start and auto-scaling times by maintaining a set of idle, ready-to-use instances.
    • databricks.Job to manage Databricks Jobs to run non-interactive code in a databricks_cluster.
    • databricks.Library to install a library on databricks_cluster.
    • databricks.Pipeline to deploy Delta Live Tables.

    Using getClusters

    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 getClusters(args: GetClustersArgs, opts?: InvokeOptions): Promise<GetClustersResult>
    function getClustersOutput(args: GetClustersOutputArgs, opts?: InvokeOptions): Output<GetClustersResult>
    def get_clusters(cluster_name_contains: Optional[str] = None,
                     filter_by: Optional[GetClustersFilterBy] = None,
                     id: Optional[str] = None,
                     ids: Optional[Sequence[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> GetClustersResult
    def get_clusters_output(cluster_name_contains: Optional[pulumi.Input[str]] = None,
                     filter_by: Optional[pulumi.Input[GetClustersFilterByArgs]] = None,
                     id: Optional[pulumi.Input[str]] = None,
                     ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetClustersResult]
    func GetClusters(ctx *Context, args *GetClustersArgs, opts ...InvokeOption) (*GetClustersResult, error)
    func GetClustersOutput(ctx *Context, args *GetClustersOutputArgs, opts ...InvokeOption) GetClustersResultOutput

    > Note: This function is named GetClusters in the Go SDK.

    public static class GetClusters 
    {
        public static Task<GetClustersResult> InvokeAsync(GetClustersArgs args, InvokeOptions? opts = null)
        public static Output<GetClustersResult> Invoke(GetClustersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetClustersResult> getClusters(GetClustersArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: databricks:index/getClusters:getClusters
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ClusterNameContains string
    Only return databricks.Cluster ids that match the given name string.
    FilterBy GetClustersFilterBy
    Filters to apply to the listed clusters. See filter_by Configuration Block below for details.
    Id string
    Ids List<string>
    list of databricks.Cluster ids
    ClusterNameContains string
    Only return databricks.Cluster ids that match the given name string.
    FilterBy GetClustersFilterBy
    Filters to apply to the listed clusters. See filter_by Configuration Block below for details.
    Id string
    Ids []string
    list of databricks.Cluster ids
    clusterNameContains String
    Only return databricks.Cluster ids that match the given name string.
    filterBy GetClustersFilterBy
    Filters to apply to the listed clusters. See filter_by Configuration Block below for details.
    id String
    ids List<String>
    list of databricks.Cluster ids
    clusterNameContains string
    Only return databricks.Cluster ids that match the given name string.
    filterBy GetClustersFilterBy
    Filters to apply to the listed clusters. See filter_by Configuration Block below for details.
    id string
    ids string[]
    list of databricks.Cluster ids
    cluster_name_contains str
    Only return databricks.Cluster ids that match the given name string.
    filter_by GetClustersFilterBy
    Filters to apply to the listed clusters. See filter_by Configuration Block below for details.
    id str
    ids Sequence[str]
    list of databricks.Cluster ids
    clusterNameContains String
    Only return databricks.Cluster ids that match the given name string.
    filterBy Property Map
    Filters to apply to the listed clusters. See filter_by Configuration Block below for details.
    id String
    ids List<String>
    list of databricks.Cluster ids

    getClusters Result

    The following output properties are available:

    Id string
    Ids List<string>
    list of databricks.Cluster ids
    ClusterNameContains string
    FilterBy GetClustersFilterBy
    Id string
    Ids []string
    list of databricks.Cluster ids
    ClusterNameContains string
    FilterBy GetClustersFilterBy
    id String
    ids List<String>
    list of databricks.Cluster ids
    clusterNameContains String
    filterBy GetClustersFilterBy
    id string
    ids string[]
    list of databricks.Cluster ids
    clusterNameContains string
    filterBy GetClustersFilterBy
    id str
    ids Sequence[str]
    list of databricks.Cluster ids
    cluster_name_contains str
    filter_by GetClustersFilterBy
    id String
    ids List<String>
    list of databricks.Cluster ids
    clusterNameContains String
    filterBy Property Map

    Supporting Types

    GetClustersFilterBy

    ClusterSources List<string>
    List of cluster sources to filter by. Possible values are API, JOB, MODELS, PIPELINE, PIPELINE_MAINTENANCE, SQL, and UI.
    ClusterStates List<string>
    List of cluster states to filter by. Possible values are RUNNING, PENDING, RESIZING, RESTARTING, TERMINATING, TERMINATED, ERROR, and UNKNOWN.
    IsPinned bool
    Whether to filter by pinned clusters.
    PolicyId string
    Filter by databricks.ClusterPolicy id.
    ClusterSources []string
    List of cluster sources to filter by. Possible values are API, JOB, MODELS, PIPELINE, PIPELINE_MAINTENANCE, SQL, and UI.
    ClusterStates []string
    List of cluster states to filter by. Possible values are RUNNING, PENDING, RESIZING, RESTARTING, TERMINATING, TERMINATED, ERROR, and UNKNOWN.
    IsPinned bool
    Whether to filter by pinned clusters.
    PolicyId string
    Filter by databricks.ClusterPolicy id.
    clusterSources List<String>
    List of cluster sources to filter by. Possible values are API, JOB, MODELS, PIPELINE, PIPELINE_MAINTENANCE, SQL, and UI.
    clusterStates List<String>
    List of cluster states to filter by. Possible values are RUNNING, PENDING, RESIZING, RESTARTING, TERMINATING, TERMINATED, ERROR, and UNKNOWN.
    isPinned Boolean
    Whether to filter by pinned clusters.
    policyId String
    Filter by databricks.ClusterPolicy id.
    clusterSources string[]
    List of cluster sources to filter by. Possible values are API, JOB, MODELS, PIPELINE, PIPELINE_MAINTENANCE, SQL, and UI.
    clusterStates string[]
    List of cluster states to filter by. Possible values are RUNNING, PENDING, RESIZING, RESTARTING, TERMINATING, TERMINATED, ERROR, and UNKNOWN.
    isPinned boolean
    Whether to filter by pinned clusters.
    policyId string
    Filter by databricks.ClusterPolicy id.
    cluster_sources Sequence[str]
    List of cluster sources to filter by. Possible values are API, JOB, MODELS, PIPELINE, PIPELINE_MAINTENANCE, SQL, and UI.
    cluster_states Sequence[str]
    List of cluster states to filter by. Possible values are RUNNING, PENDING, RESIZING, RESTARTING, TERMINATING, TERMINATED, ERROR, and UNKNOWN.
    is_pinned bool
    Whether to filter by pinned clusters.
    policy_id str
    Filter by databricks.ClusterPolicy id.
    clusterSources List<String>
    List of cluster sources to filter by. Possible values are API, JOB, MODELS, PIPELINE, PIPELINE_MAINTENANCE, SQL, and UI.
    clusterStates List<String>
    List of cluster states to filter by. Possible values are RUNNING, PENDING, RESIZING, RESTARTING, TERMINATING, TERMINATED, ERROR, and UNKNOWN.
    isPinned Boolean
    Whether to filter by pinned clusters.
    policyId String
    Filter by databricks.ClusterPolicy id.

    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.56.0 published on Tuesday, Nov 12, 2024 by Pulumi