UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

206 lines • 7.8 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Cluster = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * Manages a Cloud Dataproc cluster resource within GCP. * * * [API documentation](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.clusters) * * How-to Guides * * [Official Documentation](https://cloud.google.com/dataproc/docs) * * !> **Warning:** Due to limitations of the API, all arguments except * `labels`,`cluster_config.worker_config.num_instances` and `cluster_config.preemptible_worker_config.num_instances` are non-updatable. Changing `cluster_config.worker_config.min_num_instances` will be ignored. Changing others will cause recreation of the * whole cluster! * * ## Example Usage * * ### Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const simplecluster = new gcp.dataproc.Cluster("simplecluster", { * name: "simplecluster", * region: "us-central1", * }); * ``` * * ### Advanced * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.serviceaccount.Account("default", { * accountId: "service-account-id", * displayName: "Service Account", * }); * const mycluster = new gcp.dataproc.Cluster("mycluster", { * name: "mycluster", * region: "us-central1", * gracefulDecommissionTimeout: "120s", * labels: { * foo: "bar", * }, * clusterConfig: { * stagingBucket: "dataproc-staging-bucket", * engine: "DEFAULT", * masterConfig: { * numInstances: 1, * machineType: "e2-medium", * diskConfig: { * bootDiskType: "pd-ssd", * bootDiskSizeGb: 30, * }, * }, * workerConfig: { * numInstances: 2, * machineType: "e2-medium", * minCpuPlatform: "Intel Skylake", * diskConfig: { * bootDiskSizeGb: 30, * numLocalSsds: 1, * }, * }, * preemptibleWorkerConfig: { * numInstances: 0, * }, * softwareConfig: { * imageVersion: "2.0.35-debian10", * overrideProperties: { * "dataproc:dataproc.allow.zero.workers": "true", * }, * }, * gceClusterConfig: { * tags: [ * "foo", * "bar", * ], * serviceAccount: _default.email, * serviceAccountScopes: ["cloud-platform"], * }, * initializationActions: [{ * script: "gs://dataproc-initialization-actions/stackdriver/stackdriver.sh", * timeoutSec: 500, * }], * }, * }); * ``` * * ### Using A GPU Accelerator * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const acceleratedCluster = new gcp.dataproc.Cluster("accelerated_cluster", { * name: "my-cluster-with-gpu", * region: "us-central1", * clusterConfig: { * gceClusterConfig: { * zone: "us-central1-a", * }, * masterConfig: { * accelerators: [{ * acceleratorType: "nvidia-tesla-k80", * acceleratorCount: 1, * }], * }, * }, * }); * ``` * * ## Import * * This resource does not support import. */ class Cluster extends pulumi.CustomResource { /** * Get an existing Cluster 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 Cluster(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:dataproc/cluster:Cluster'; /** * Returns true if the given object is an instance of Cluster. 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'] === Cluster.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["clusterConfig"] = state?.clusterConfig; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["gracefulDecommissionTimeout"] = state?.gracefulDecommissionTimeout; resourceInputs["labels"] = state?.labels; resourceInputs["name"] = state?.name; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["region"] = state?.region; resourceInputs["virtualClusterConfig"] = state?.virtualClusterConfig; } else { const args = argsOrState; resourceInputs["clusterConfig"] = args?.clusterConfig; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["gracefulDecommissionTimeout"] = args?.gracefulDecommissionTimeout; resourceInputs["labels"] = args?.labels; resourceInputs["name"] = args?.name; resourceInputs["project"] = args?.project; resourceInputs["region"] = args?.region; resourceInputs["virtualClusterConfig"] = args?.virtualClusterConfig; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Cluster.__pulumiType, name, resourceInputs, opts); } } exports.Cluster = Cluster; //# sourceMappingURL=cluster.js.map