@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
180 lines • 6.92 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.Cluster = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = 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",
* 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, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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 ? state.clusterConfig : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["gracefulDecommissionTimeout"] = state ? state.gracefulDecommissionTimeout : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["virtualClusterConfig"] = state ? state.virtualClusterConfig : undefined;
}
else {
const args = argsOrState;
resourceInputs["clusterConfig"] = args ? args.clusterConfig : undefined;
resourceInputs["gracefulDecommissionTimeout"] = args ? args.gracefulDecommissionTimeout : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["virtualClusterConfig"] = args ? args.virtualClusterConfig : undefined;
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;
/** @internal */
Cluster.__pulumiType = 'gcp:dataproc/cluster:Cluster';
//# sourceMappingURL=cluster.js.map