UNPKG

@pulumi/gcp

Version:

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

312 lines • 13.2 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.Instance = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * > **Warning:** `gcp.notebooks.Instance` is deprecated and will be removed in a future major release. Use `gcp.workbench.Instance` instead. * * A Cloud AI Platform Notebook instance. * * > **Note:** Due to limitations of the Notebooks Instance API, many fields * in this resource do not properly detect drift. These fields will also not * appear in state once imported. * * To get more information about Instance, see: * * * [API documentation](https://cloud.google.com/ai-platform/notebooks/docs/reference/rest) * * How-to Guides * * [Official Documentation](https://cloud.google.com/ai-platform-notebooks) * * ## Example Usage * * ### Notebook Instance Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.notebooks.Instance("instance", { * name: "notebooks-instance", * location: "us-west1-a", * machineType: "e2-medium", * vmImage: { * project: "cloud-notebooks-managed", * imageFamily: "workbench-instances", * }, * }); * ``` * ### Notebook Instance Basic Stopped * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.notebooks.Instance("instance", { * name: "notebooks-instance", * location: "us-west1-a", * machineType: "e2-medium", * vmImage: { * project: "cloud-notebooks-managed", * imageFamily: "workbench-instances", * }, * desiredState: "STOPPED", * }); * ``` * ### Notebook Instance Basic Container * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.notebooks.Instance("instance", { * name: "notebooks-instance", * location: "us-west1-a", * machineType: "e2-medium", * metadata: { * "proxy-mode": "service_account", * }, * containerImage: { * repository: "gcr.io/deeplearning-platform-release/base-cpu", * tag: "latest", * }, * }); * ``` * ### Notebook Instance Basic Gpu * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.notebooks.Instance("instance", { * name: "notebooks-instance", * location: "us-west1-a", * machineType: "n1-standard-1", * installGpuDriver: true, * acceleratorConfig: { * type: "NVIDIA_TESLA_T4", * coreCount: 1, * }, * vmImage: { * project: "cloud-notebooks-managed", * imageFamily: "workbench-instances", * }, * }); * ``` * ### Notebook Instance Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const myNetwork = gcp.compute.getNetwork({ * name: "default", * }); * const mySubnetwork = gcp.compute.getSubnetwork({ * name: "default", * region: "us-central1", * }); * const instance = new gcp.notebooks.Instance("instance", { * name: "notebooks-instance", * location: "us-central1-a", * machineType: "e2-medium", * vmImage: { * project: "cloud-notebooks-managed", * imageFamily: "workbench-instances", * }, * instanceOwners: ["my@service-account.com"], * serviceAccount: "my@service-account.com", * installGpuDriver: true, * bootDiskType: "PD_SSD", * bootDiskSizeGb: 150, * noPublicIp: true, * noProxyAccess: true, * network: myNetwork.then(myNetwork => myNetwork.id), * subnet: mySubnetwork.then(mySubnetwork => mySubnetwork.id), * labels: { * k: "val", * }, * metadata: { * terraform: "true", * }, * serviceAccountScopes: [ * "https://www.googleapis.com/auth/bigquery", * "https://www.googleapis.com/auth/devstorage.read_write", * "https://www.googleapis.com/auth/cloud-platform", * "https://www.googleapis.com/auth/userinfo.email", * ], * tags: [ * "foo", * "bar", * ], * diskEncryption: "CMEK", * kmsKey: "my-crypto-key", * desiredState: "ACTIVE", * }); * ``` * * ## Import * * Instance can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/instances/{{name}}` * * `{{project}}/{{location}}/{{name}}` * * `{{location}}/{{name}}` * * When using the `pulumi import` command, Instance can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:notebooks/instance:Instance default projects/{{project}}/locations/{{location}}/instances/{{name}} * $ pulumi import gcp:notebooks/instance:Instance default {{project}}/{{location}}/{{name}} * $ pulumi import gcp:notebooks/instance:Instance default {{location}}/{{name}} * ``` */ class Instance extends pulumi.CustomResource { /** * Get an existing Instance 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 Instance(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:notebooks/instance:Instance'; /** * Returns true if the given object is an instance of Instance. 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'] === Instance.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["acceleratorConfig"] = state?.acceleratorConfig; resourceInputs["bootDiskSizeGb"] = state?.bootDiskSizeGb; resourceInputs["bootDiskType"] = state?.bootDiskType; resourceInputs["containerImage"] = state?.containerImage; resourceInputs["createTime"] = state?.createTime; resourceInputs["customGpuDriverPath"] = state?.customGpuDriverPath; resourceInputs["dataDiskSizeGb"] = state?.dataDiskSizeGb; resourceInputs["dataDiskType"] = state?.dataDiskType; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["desiredState"] = state?.desiredState; resourceInputs["diskEncryption"] = state?.diskEncryption; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["installGpuDriver"] = state?.installGpuDriver; resourceInputs["instanceOwners"] = state?.instanceOwners; resourceInputs["kmsKey"] = state?.kmsKey; resourceInputs["labels"] = state?.labels; resourceInputs["location"] = state?.location; resourceInputs["machineType"] = state?.machineType; resourceInputs["metadata"] = state?.metadata; resourceInputs["name"] = state?.name; resourceInputs["network"] = state?.network; resourceInputs["nicType"] = state?.nicType; resourceInputs["noProxyAccess"] = state?.noProxyAccess; resourceInputs["noPublicIp"] = state?.noPublicIp; resourceInputs["noRemoveDataDisk"] = state?.noRemoveDataDisk; resourceInputs["postStartupScript"] = state?.postStartupScript; resourceInputs["project"] = state?.project; resourceInputs["proxyUri"] = state?.proxyUri; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["reservationAffinity"] = state?.reservationAffinity; resourceInputs["serviceAccount"] = state?.serviceAccount; resourceInputs["serviceAccountScopes"] = state?.serviceAccountScopes; resourceInputs["shieldedInstanceConfig"] = state?.shieldedInstanceConfig; resourceInputs["state"] = state?.state; resourceInputs["subnet"] = state?.subnet; resourceInputs["tags"] = state?.tags; resourceInputs["updateTime"] = state?.updateTime; resourceInputs["vmImage"] = state?.vmImage; } else { const args = argsOrState; if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } if (args?.machineType === undefined && !opts.urn) { throw new Error("Missing required property 'machineType'"); } resourceInputs["acceleratorConfig"] = args?.acceleratorConfig; resourceInputs["bootDiskSizeGb"] = args?.bootDiskSizeGb; resourceInputs["bootDiskType"] = args?.bootDiskType; resourceInputs["containerImage"] = args?.containerImage; resourceInputs["createTime"] = args?.createTime; resourceInputs["customGpuDriverPath"] = args?.customGpuDriverPath; resourceInputs["dataDiskSizeGb"] = args?.dataDiskSizeGb; resourceInputs["dataDiskType"] = args?.dataDiskType; resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["desiredState"] = args?.desiredState; resourceInputs["diskEncryption"] = args?.diskEncryption; resourceInputs["installGpuDriver"] = args?.installGpuDriver; resourceInputs["instanceOwners"] = args?.instanceOwners; resourceInputs["kmsKey"] = args?.kmsKey; resourceInputs["labels"] = args?.labels; resourceInputs["location"] = args?.location; resourceInputs["machineType"] = args?.machineType; resourceInputs["metadata"] = args?.metadata; resourceInputs["name"] = args?.name; resourceInputs["network"] = args?.network; resourceInputs["nicType"] = args?.nicType; resourceInputs["noProxyAccess"] = args?.noProxyAccess; resourceInputs["noPublicIp"] = args?.noPublicIp; resourceInputs["noRemoveDataDisk"] = args?.noRemoveDataDisk; resourceInputs["postStartupScript"] = args?.postStartupScript; resourceInputs["project"] = args?.project; resourceInputs["reservationAffinity"] = args?.reservationAffinity; resourceInputs["serviceAccount"] = args?.serviceAccount; resourceInputs["serviceAccountScopes"] = args?.serviceAccountScopes; resourceInputs["shieldedInstanceConfig"] = args?.shieldedInstanceConfig; resourceInputs["subnet"] = args?.subnet; resourceInputs["tags"] = args?.tags; resourceInputs["updateTime"] = args?.updateTime; resourceInputs["vmImage"] = args?.vmImage; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["proxyUri"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Instance.__pulumiType, name, resourceInputs, opts); } } exports.Instance = Instance; //# sourceMappingURL=instance.js.map