databricks logo
Databricks v1.6.0, Jan 25 23

databricks.getClusterPolicy

Example Usage

Referring to a cluster policy by name

using System.Collections.Generic;
using Pulumi;
using Databricks = Pulumi.Databricks;

return await Deployment.RunAsync(() => 
{
    var personal = Databricks.GetClusterPolicy.Invoke(new()
    {
        Name = "Personal Compute",
    });

    var myCluster = new Databricks.Cluster("myCluster", new()
    {
        PolicyId = personal.Apply(getClusterPolicyResult => getClusterPolicyResult.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: "Personal Compute",
		}, nil)
		if err != nil {
			return err
		}
		_, err = databricks.NewCluster(ctx, "myCluster", &databricks.ClusterArgs{
			PolicyId: *pulumi.String(personal.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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());

    }
}
import pulumi
import pulumi_databricks as databricks

personal = databricks.get_cluster_policy(name="Personal Compute")
my_cluster = databricks.Cluster("myCluster", policy_id=personal.id)
# ...
import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";

const personal = databricks.getClusterPolicy({
    name: "Personal Compute",
});
const myCluster = new databricks.Cluster("myCluster", {policyId: personal.then(personal => personal.id)});
// ...
resources:
  myCluster:
    type: databricks: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(name: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetClusterPolicyResult
def get_cluster_policy_output(name: 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:

Name string

Name of the cluster policy. The cluster policy must exist before this resource can be planned.

Name string

Name of the cluster policy. The cluster policy must exist before this resource can be planned.

name String

Name of the cluster policy. The cluster policy must exist before this resource can be planned.

name string

Name of the cluster policy. The cluster policy must exist before this resource can be planned.

name str

Name of the cluster policy. The cluster policy must exist before this resource can be planned.

name String

Name of the cluster policy. The cluster policy must exist before this resource can be planned.

getClusterPolicy Result

The following output properties are available:

Definition string

Policy definition: JSON document expressed in Databricks Policy Definition Language.

Id string

The provider-assigned unique ID for this managed resource.

MaxClustersPerUser int
Name string
Definition string

Policy definition: JSON document expressed in Databricks Policy Definition Language.

Id string

The provider-assigned unique ID for this managed resource.

MaxClustersPerUser int
Name string
definition String

Policy definition: JSON document expressed in Databricks Policy Definition Language.

id String

The provider-assigned unique ID for this managed resource.

maxClustersPerUser Integer
name String
definition string

Policy definition: JSON document expressed in Databricks Policy Definition Language.

id string

The provider-assigned unique ID for this managed resource.

maxClustersPerUser number
name string
definition str

Policy definition: JSON document expressed in Databricks Policy Definition Language.

id str

The provider-assigned unique ID for this managed resource.

max_clusters_per_user int
name str
definition String

Policy definition: JSON document expressed in Databricks Policy Definition Language.

id String

The provider-assigned unique ID for this managed resource.

maxClustersPerUser Number
name String

Package Details

Repository
databricks pulumi/pulumi-databricks
License
Apache-2.0
Notes

This Pulumi package is based on the databricks Terraform Provider.