@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
147 lines • 7.05 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstancePool = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* This resource allows you 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. An instance pool reduces cluster start and auto-scaling times by maintaining a set of idle, ready-to-use cloud instances. When a cluster attached to a pool needs an instance, it first attempts to allocate one of the pool's idle instances. If the pool has no idle instances, it expands by allocating a new instance from the instance provider in order to accommodate the cluster's request. When a cluster releases an instance, it returns to the pool and is free for another cluster to use. Only clusters attached to a pool can use that pool's idle instances.
*
* > This resource can only be used with a workspace-level provider!
*
* > It is important to know that different cloud service providers have different `nodeTypeId`, `diskSpecs` and potentially other configurations.
*
* > "auto" `zoneId` is only supported for fleet node types.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const smallest = databricks.getNodeType({});
* const smallestNodes = new databricks.InstancePool("smallest_nodes", {
* instancePoolName: "Smallest Nodes",
* minIdleInstances: 0,
* maxCapacity: 300,
* nodeTypeId: smallest.then(smallest => smallest.id),
* awsAttributes: {
* availability: "ON_DEMAND",
* zoneId: "us-east-1a",
* spotBidPricePercent: 100,
* },
* idleInstanceAutoterminationMinutes: 10,
* diskSpec: {
* diskType: {
* ebsVolumeType: "GENERAL_PURPOSE_SSD",
* },
* diskSize: 80,
* diskCount: 1,
* },
* });
* ```
*
* ## Access Control
*
* * databricks.Group and databricks.User can control which groups or individual users can create instance pools.
* * databricks.Permissions can control which groups or individual users can *Manage* or *Attach to* individual instance pools.
*
* ## Import
*
* The resource instance pool can be imported using its id:
*
* hcl
*
* import {
*
* to = databricks_instance_pool.this
*
* id = "<instance-pool-id>"
*
* }
*
* Alternatively, when using `terraform` version 1.4 or earlier, import using the `pulumi import` command:
*
* bash
*
* ```sh
* $ pulumi import databricks:index/instancePool:InstancePool this <instance-pool-id>
* ```
*/
class InstancePool extends pulumi.CustomResource {
/**
* Get an existing InstancePool 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 InstancePool(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of InstancePool. 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'] === InstancePool.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["awsAttributes"] = state?.awsAttributes;
resourceInputs["azureAttributes"] = state?.azureAttributes;
resourceInputs["customTags"] = state?.customTags;
resourceInputs["diskSpec"] = state?.diskSpec;
resourceInputs["enableElasticDisk"] = state?.enableElasticDisk;
resourceInputs["gcpAttributes"] = state?.gcpAttributes;
resourceInputs["idleInstanceAutoterminationMinutes"] = state?.idleInstanceAutoterminationMinutes;
resourceInputs["instancePoolFleetAttributes"] = state?.instancePoolFleetAttributes;
resourceInputs["instancePoolId"] = state?.instancePoolId;
resourceInputs["instancePoolName"] = state?.instancePoolName;
resourceInputs["maxCapacity"] = state?.maxCapacity;
resourceInputs["minIdleInstances"] = state?.minIdleInstances;
resourceInputs["nodeTypeId"] = state?.nodeTypeId;
resourceInputs["preloadedDockerImages"] = state?.preloadedDockerImages;
resourceInputs["preloadedSparkVersions"] = state?.preloadedSparkVersions;
}
else {
const args = argsOrState;
if (args?.idleInstanceAutoterminationMinutes === undefined && !opts.urn) {
throw new Error("Missing required property 'idleInstanceAutoterminationMinutes'");
}
if (args?.instancePoolName === undefined && !opts.urn) {
throw new Error("Missing required property 'instancePoolName'");
}
resourceInputs["awsAttributes"] = args?.awsAttributes;
resourceInputs["azureAttributes"] = args?.azureAttributes;
resourceInputs["customTags"] = args?.customTags;
resourceInputs["diskSpec"] = args?.diskSpec;
resourceInputs["enableElasticDisk"] = args?.enableElasticDisk;
resourceInputs["gcpAttributes"] = args?.gcpAttributes;
resourceInputs["idleInstanceAutoterminationMinutes"] = args?.idleInstanceAutoterminationMinutes;
resourceInputs["instancePoolFleetAttributes"] = args?.instancePoolFleetAttributes;
resourceInputs["instancePoolId"] = args?.instancePoolId;
resourceInputs["instancePoolName"] = args?.instancePoolName;
resourceInputs["maxCapacity"] = args?.maxCapacity;
resourceInputs["minIdleInstances"] = args?.minIdleInstances;
resourceInputs["nodeTypeId"] = args?.nodeTypeId;
resourceInputs["preloadedDockerImages"] = args?.preloadedDockerImages;
resourceInputs["preloadedSparkVersions"] = args?.preloadedSparkVersions;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(InstancePool.__pulumiType, name, resourceInputs, opts);
}
}
exports.InstancePool = InstancePool;
/** @internal */
InstancePool.__pulumiType = 'databricks:index/instancePool:InstancePool';
//# sourceMappingURL=instancePool.js.map