@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
141 lines • 8.25 kB
JavaScript
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClusterPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* This resource creates a cluster policy, which limits the ability to create clusters based on a set of rules. The policy rules limit the attributes or attribute values available for cluster creation. cluster policies have ACLs that limit their use to specific users and groups. Only admin users can create, edit, and delete policies. Admin users also have access to all policies.
*
* Cluster policies let you:
*
* * Limit users to create clusters with prescribed settings.
* * Simplify the user interface and enable more users to create their own clusters (by fixing and hiding some values).
* * Control cost by limiting per cluster maximum cost (by setting limits on attributes whose values contribute to hourly price).
*
* Cluster policy permissions limit which policies a user can select in the Policy drop-down when the user creates a cluster:
*
* * If no policies have been created in the workspace, the Policy drop-down does not display.
* * A user who has cluster create permission can select the `Free form` policy and create fully-configurable clusters.
* * A user who has both cluster create permission and access to cluster policies can select the Free form policy and policies they have access to.
* * A user that has access to only cluster policies, can select the policies they have access to.
*
* ### Overriding the built-in cluster policies
*
* You can override built-in cluster policies by creating a `databricks.ClusterPolicy` resource with following attributes:
*
* * `name` - the name of the built-in cluster policy.
* * `policyFamilyId` - the ID of the cluster policy family used for built-in cluster policy.
* * `policyFamilyDefinitionOverrides` - settings to override in the built-in cluster policy.
*
* You can obtain the list of defined cluster policies families using the `databricks policy-families list` command of the new [Databricks CLI](https://docs.databricks.com/en/dev-tools/cli/index.html), or via [list policy families](https://docs.databricks.com/api/workspace/policyfamilies/list) REST API.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const personalVmOverride = {
* autotermination_minutes: {
* type: "fixed",
* value: 220,
* hidden: true,
* },
* "custom_tags.Team": {
* type: "fixed",
* value: team,
* },
* };
* const personalVm = new databricks.ClusterPolicy("personal_vm", {
* policyFamilyId: "personal-vm",
* policyFamilyDefinitionOverrides: JSON.stringify(personalVmOverride),
* name: "Personal Compute",
* });
* ```
*
* ## Related Resources
*
* The following resources are often used in the same context:
*
* * Dynamic Passthrough Clusters for a Group guide.
* * End to end workspace management guide.
* * databricks.getClusters data to retrieve a list of databricks.Cluster ids.
* * databricks.Cluster to create [Databricks Clusters](https://docs.databricks.com/clusters/index.html).
* * databricks.getCurrentUser data to retrieve information about databricks.User or databricks_service_principal, that is calling Databricks REST API.
* * databricks.GlobalInitScript to manage [global init scripts](https://docs.databricks.com/clusters/init-scripts.html#global-init-scripts), which are run on all databricks.Cluster and databricks_job.
* * databricks.InstancePool to manage [instance pools](https://docs.databricks.com/clusters/instance-pools/index.html) to reduce cluster start and auto-scaling times by maintaining a set of idle, ready-to-use instances.
* * databricks.InstanceProfile to manage AWS EC2 instance profiles that users can launch databricks.Cluster and access data, like databricks_mount.
* * databricks.IpAccessList to allow access from [predefined IP ranges](https://docs.databricks.com/security/network/ip-access-list.html).
* * databricks.Library to install a [library](https://docs.databricks.com/libraries/index.html) on databricks_cluster.
* * databricks.getNodeType data to get the smallest node type for databricks.Cluster that fits search criteria, like amount of RAM or number of cores.
* * databricks.Permissions to manage [access control](https://docs.databricks.com/security/access-control/index.html) in Databricks workspace.
* * databricks.getSparkVersion data to get [Databricks Runtime (DBR)](https://docs.databricks.com/runtime/dbr.html) version that could be used for `sparkVersion` parameter in databricks.Cluster and other resources.
* * databricks.UserInstanceProfile to attach databricks.InstanceProfile (AWS) to databricks_user.
* * databricks.WorkspaceConf to manage workspace configuration for expert usage.
*
* ## Import
*
* The resource cluster policy can be imported using the policy id:
*
* bash
*
* ```sh
* $ pulumi import databricks:index/clusterPolicy:ClusterPolicy this <cluster-policy-id>
* ```
*/
class ClusterPolicy extends pulumi.CustomResource {
/**
* Get an existing ClusterPolicy resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new ClusterPolicy(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of ClusterPolicy. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === ClusterPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["definition"] = state ? state.definition : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["libraries"] = state ? state.libraries : undefined;
resourceInputs["maxClustersPerUser"] = state ? state.maxClustersPerUser : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["policyFamilyDefinitionOverrides"] = state ? state.policyFamilyDefinitionOverrides : undefined;
resourceInputs["policyFamilyId"] = state ? state.policyFamilyId : undefined;
resourceInputs["policyId"] = state ? state.policyId : undefined;
}
else {
const args = argsOrState;
resourceInputs["definition"] = args ? args.definition : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["libraries"] = args ? args.libraries : undefined;
resourceInputs["maxClustersPerUser"] = args ? args.maxClustersPerUser : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["policyFamilyDefinitionOverrides"] = args ? args.policyFamilyDefinitionOverrides : undefined;
resourceInputs["policyFamilyId"] = args ? args.policyFamilyId : undefined;
resourceInputs["policyId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ClusterPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.ClusterPolicy = ClusterPolicy;
/** @internal */
ClusterPolicy.__pulumiType = 'databricks:index/clusterPolicy:ClusterPolicy';
//# sourceMappingURL=clusterPolicy.js.map
;