@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
259 lines • 10.5 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! ***
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.WorkflowTemplate = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* A Workflow Template is a reusable workflow configuration. It defines a graph of jobs with information on where to run those jobs.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const template = new gcp.dataproc.WorkflowTemplate("template", {
* name: "template-example",
* location: "us-central1",
* placement: {
* managedCluster: {
* clusterName: "my-cluster",
* config: {
* gceClusterConfig: {
* zone: "us-central1-a",
* tags: [
* "foo",
* "bar",
* ],
* },
* masterConfig: {
* numInstances: 1,
* machineType: "n1-standard-1",
* diskConfig: {
* bootDiskType: "pd-ssd",
* bootDiskSizeGb: 15,
* },
* },
* workerConfig: {
* numInstances: 3,
* machineType: "n1-standard-2",
* diskConfig: {
* bootDiskSizeGb: 10,
* numLocalSsds: 2,
* },
* },
* secondaryWorkerConfig: {
* numInstances: 2,
* },
* softwareConfig: {
* imageVersion: "2.0.35-debian10",
* },
* },
* },
* },
* jobs: [
* {
* stepId: "someJob",
* sparkJob: {
* mainClass: "SomeClass",
* },
* },
* {
* stepId: "otherJob",
* prerequisiteStepIds: ["someJob"],
* prestoJob: {
* queryFileUri: "someuri",
* },
* },
* ],
* });
* ```
*
* ### Encryption Config With Spark Jobs
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* // Grant Dataproc service account KMS permissions at project level
* const dataprocKmsEncrypterDecrypter = new gcp.projects.IAMMember("dataproc_kms_encrypter_decrypter", {
* project: project.name,
* role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
* member: `serviceAccount:service-${project.number}@dataproc-accounts.iam.gserviceaccount.com`,
* });
* const example = new gcp.dataproc.WorkflowTemplate("example", {
* name: workflowTemplateName,
* location: region,
* encryptionConfig: {
* kmsKey: "<<-- uri to desired crypto key for customer management -->>",
* },
* placement: {
* managedCluster: {
* clusterName: clusterName,
* config: {
* gceClusterConfig: {
* zone: zone,
* network: network,
* },
* masterConfig: {
* numInstances: 1,
* machineType: machineType,
* diskConfig: {
* bootDiskType: "pd-standard",
* bootDiskSizeGb: 100,
* },
* },
* workerConfig: {
* numInstances: 2,
* machineType: machineType,
* diskConfig: {
* bootDiskType: "pd-standard",
* bootDiskSizeGb: 100,
* },
* },
* },
* },
* },
* jobs: [
* {
* stepId: "example-job",
* sparkJob: {
* mainClass: "org.apache.spark.examples.SparkPi",
* jarFileUris: ["file:///usr/lib/spark/examples/jars/spark-examples.jar"],
* args: ["1000"],
* },
* },
* {
* stepId: "example-pyspark-job",
* pysparkJob: {
* mainPythonFileUri: "gs://dataproc-examples/pyspark/hello-world/hello-world.py",
* },
* },
* ],
* }, {
* dependsOn: [dataprocKmsEncrypterDecrypter],
* });
* ```
*
* ## Import
*
* WorkflowTemplate can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/workflowTemplates/{{name}}`
* * `{{project}}/{{location}}/{{name}}`
* * `{{location}}/{{name}}`
*
* When using the `pulumi import` command, WorkflowTemplate can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:dataproc/workflowTemplate:WorkflowTemplate default projects/{{project}}/locations/{{location}}/workflowTemplates/{{name}}
* $ pulumi import gcp:dataproc/workflowTemplate:WorkflowTemplate default {{project}}/{{location}}/{{name}}
* $ pulumi import gcp:dataproc/workflowTemplate:WorkflowTemplate default {{location}}/{{name}}
* ```
*/
class WorkflowTemplate extends pulumi.CustomResource {
/**
* Get an existing WorkflowTemplate 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 WorkflowTemplate(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:dataproc/workflowTemplate:WorkflowTemplate';
/**
* Returns true if the given object is an instance of WorkflowTemplate. 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'] === WorkflowTemplate.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["dagTimeout"] = state?.dagTimeout;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["effectiveLabels"] = state?.effectiveLabels;
resourceInputs["encryptionConfig"] = state?.encryptionConfig;
resourceInputs["jobs"] = state?.jobs;
resourceInputs["labels"] = state?.labels;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["parameters"] = state?.parameters;
resourceInputs["placement"] = state?.placement;
resourceInputs["project"] = state?.project;
resourceInputs["pulumiLabels"] = state?.pulumiLabels;
resourceInputs["updateTime"] = state?.updateTime;
resourceInputs["version"] = state?.version;
}
else {
const args = argsOrState;
if (args?.jobs === undefined && !opts.urn) {
throw new Error("Missing required property 'jobs'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if (args?.placement === undefined && !opts.urn) {
throw new Error("Missing required property 'placement'");
}
resourceInputs["dagTimeout"] = args?.dagTimeout;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["encryptionConfig"] = args?.encryptionConfig;
resourceInputs["jobs"] = args?.jobs;
resourceInputs["labels"] = args?.labels;
resourceInputs["location"] = args?.location;
resourceInputs["name"] = args?.name;
resourceInputs["parameters"] = args?.parameters;
resourceInputs["placement"] = args?.placement;
resourceInputs["project"] = args?.project;
resourceInputs["version"] = args?.version;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(WorkflowTemplate.__pulumiType, name, resourceInputs, opts);
}
}
exports.WorkflowTemplate = WorkflowTemplate;
//# sourceMappingURL=workflowTemplate.js.map