UNPKG

@pulumi/gcp

Version:

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

294 lines • 11.6 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.SessionTemplate = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * A Dataproc Serverless session template defines the configuration settings for * creating one or more Dataproc Serverless interactive sessions. * * To get more information about SessionTemplate, see: * * * [API documentation](https://cloud.google.com/dataproc-serverless/docs/reference/rest/v1/projects.locations.sessionTemplates) * * How-to Guides * * [Dataproc Serverless Session Templates](https://cloud.google.com/dataproc-serverless/docs/guides/create-serverless-sessions-templates#create-dataproc-serverless-session-template) * * ## Example Usage * * ### Dataproc Session Templates Jupyter * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const exampleSessionTemplatesJupyter = new gcp.dataproc.SessionTemplate("example_session_templates_jupyter", { * name: "projects/my-project-name/locations/us-central1/sessionTemplates/jupyter-session-template", * location: "us-central1", * labels: { * session_template_test: "terraform", * }, * runtimeConfig: { * properties: { * "spark.dynamicAllocation.enabled": "false", * "spark.executor.instances": "2", * }, * }, * environmentConfig: { * executionConfig: { * subnetworkUri: "default", * idleTtl: "3600s", * networkTags: ["tag1"], * authenticationConfig: { * userWorkloadAuthenticationType: "END_USER_CREDENTIALS", * }, * }, * }, * jupyterSession: { * kernel: "PYTHON", * displayName: "tf python kernel", * }, * }); * ``` * ### Dataproc Session Templates Jupyter Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const gcsAccount = gcp.storage.getProjectServiceAccount({}); * const bucket = new gcp.storage.Bucket("bucket", { * uniformBucketLevelAccess: true, * name: "dataproc-bucket", * location: "US", * forceDestroy: true, * }); * const cryptoKeyMember1 = new gcp.kms.CryptoKeyIAMMember("crypto_key_member_1", { * cryptoKeyId: "example-key", * role: "roles/cloudkms.cryptoKeyEncrypterDecrypter", * member: project.then(project => `serviceAccount:service-${project.number}@dataproc-accounts.iam.gserviceaccount.com`), * }); * const ms = new gcp.dataproc.MetastoreService("ms", { * serviceId: "jupyter-session-template", * location: "us-central1", * port: 9080, * tier: "DEVELOPER", * maintenanceWindow: { * hourOfDay: 2, * dayOfWeek: "SUNDAY", * }, * hiveMetastoreConfig: { * version: "3.1.2", * }, * networkConfig: { * consumers: [{ * subnetwork: "projects/my-project-name/regions/us-central1/subnetworks/default", * }], * }, * }); * const basic = new gcp.dataproc.Cluster("basic", { * name: "jupyter-session-template", * region: "us-central1", * clusterConfig: { * softwareConfig: { * overrideProperties: { * "dataproc:dataproc.allow.zero.workers": "true", * "spark:spark.history.fs.logDirectory": pulumi.interpolate`gs://${bucket.name}/*/spark-job-history`, * }, * }, * gceClusterConfig: { * subnetwork: "default", * }, * endpointConfig: { * enableHttpPortAccess: true, * }, * masterConfig: { * numInstances: 1, * machineType: "e2-standard-2", * diskConfig: { * bootDiskSizeGb: 35, * }, * }, * metastoreConfig: { * dataprocMetastoreService: ms.name, * }, * }, * }); * const dataprocSessionTemplatesJupyterFull = new gcp.dataproc.SessionTemplate("dataproc_session_templates_jupyter_full", { * name: "projects/my-project-name/locations/us-central1/sessionTemplates/jupyter-session-template", * location: "us-central1", * labels: { * session_template_test: "terraform", * }, * runtimeConfig: { * properties: { * "spark.dynamicAllocation.enabled": "false", * "spark.executor.instances": "2", * }, * version: "2.2", * containerImage: "us-docker.pkg.dev/my-project-name/s8s-spark-test-images/s8s-spark:latest", * }, * environmentConfig: { * executionConfig: { * ttl: "3600s", * networkTags: ["tag1"], * kmsKey: "example-key", * subnetworkUri: "default", * serviceAccount: project.then(project => `${project.number}-compute@developer.gserviceaccount.com`), * stagingBucket: bucket.name, * authenticationConfig: { * userWorkloadAuthenticationType: "SERVICE_ACCOUNT", * }, * }, * peripheralsConfig: { * metastoreService: ms.name, * sparkHistoryServerConfig: { * dataprocCluster: basic.id, * }, * }, * }, * jupyterSession: { * kernel: "PYTHON", * displayName: "tf python kernel", * }, * }, { * dependsOn: [cryptoKeyMember1], * }); * ``` * ### Dataproc Session Templates Spark Connect * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const exampleSessionTemplatesSparkConnect = new gcp.dataproc.SessionTemplate("example_session_templates_spark_connect", { * name: "projects/my-project-name/locations/us-central1/sessionTemplates/sc-session-template", * location: "us-central1", * labels: { * session_template_test: "terraform", * }, * runtimeConfig: { * properties: { * "spark.dynamicAllocation.enabled": "false", * "spark.executor.instances": "2", * }, * }, * environmentConfig: { * executionConfig: { * subnetworkUri: "default", * ttl: "3600s", * networkTags: ["tag1"], * }, * }, * }); * ``` * * ## Import * * SessionTemplate can be imported using any of these accepted formats: * * * `{{name}}` * * When using the `pulumi import` command, SessionTemplate can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:dataproc/sessionTemplate:SessionTemplate default {{name}} * ``` */ class SessionTemplate extends pulumi.CustomResource { /** * Get an existing SessionTemplate 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 SessionTemplate(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:dataproc/sessionTemplate:SessionTemplate'; /** * Returns true if the given object is an instance of SessionTemplate. 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'] === SessionTemplate.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createTime"] = state?.createTime; resourceInputs["creator"] = state?.creator; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["environmentConfig"] = state?.environmentConfig; resourceInputs["jupyterSession"] = state?.jupyterSession; resourceInputs["labels"] = state?.labels; resourceInputs["location"] = state?.location; resourceInputs["name"] = state?.name; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["runtimeConfig"] = state?.runtimeConfig; resourceInputs["sparkConnectSession"] = state?.sparkConnectSession; resourceInputs["updateTime"] = state?.updateTime; resourceInputs["uuid"] = state?.uuid; } else { const args = argsOrState; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["environmentConfig"] = args?.environmentConfig; resourceInputs["jupyterSession"] = args?.jupyterSession; resourceInputs["labels"] = args?.labels; resourceInputs["location"] = args?.location; resourceInputs["name"] = args?.name; resourceInputs["project"] = args?.project; resourceInputs["runtimeConfig"] = args?.runtimeConfig; resourceInputs["sparkConnectSession"] = args?.sparkConnectSession; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["creator"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; resourceInputs["uuid"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(SessionTemplate.__pulumiType, name, resourceInputs, opts); } } exports.SessionTemplate = SessionTemplate; //# sourceMappingURL=sessionTemplate.js.map