UNPKG

@pulumi/gcp

Version:

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

295 lines • 13.4 kB
"use strict"; // *** 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.Instance = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * > **Warning:** `googleNotebookInstance` 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: "deeplearning-platform-release", * imageFamily: "tf-latest-cpu", * }, * }); * ``` * ### 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: "deeplearning-platform-release", * imageFamily: "tf-latest-cpu", * }, * 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: "deeplearning-platform-release", * imageFamily: "tf-latest-gpu", * }, * }); * ``` * ### 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: "deeplearning-platform-release", * imageFamily: "tf-latest-cpu", * }, * instanceOwners: ["my@service-account.com"], * serviceAccount: "my@service-account.com", * installGpuDriver: true, * bootDiskType: "PD_SSD", * bootDiskSizeGb: 110, * 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}} * ``` * * ```sh * $ pulumi import gcp:notebooks/instance:Instance default {{project}}/{{location}}/{{name}} * ``` * * ```sh * $ 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, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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 ? state.acceleratorConfig : undefined; resourceInputs["bootDiskSizeGb"] = state ? state.bootDiskSizeGb : undefined; resourceInputs["bootDiskType"] = state ? state.bootDiskType : undefined; resourceInputs["containerImage"] = state ? state.containerImage : undefined; resourceInputs["createTime"] = state ? state.createTime : undefined; resourceInputs["customGpuDriverPath"] = state ? state.customGpuDriverPath : undefined; resourceInputs["dataDiskSizeGb"] = state ? state.dataDiskSizeGb : undefined; resourceInputs["dataDiskType"] = state ? state.dataDiskType : undefined; resourceInputs["desiredState"] = state ? state.desiredState : undefined; resourceInputs["diskEncryption"] = state ? state.diskEncryption : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["installGpuDriver"] = state ? state.installGpuDriver : undefined; resourceInputs["instanceOwners"] = state ? state.instanceOwners : undefined; resourceInputs["kmsKey"] = state ? state.kmsKey : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["machineType"] = state ? state.machineType : undefined; resourceInputs["metadata"] = state ? state.metadata : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["network"] = state ? state.network : undefined; resourceInputs["nicType"] = state ? state.nicType : undefined; resourceInputs["noProxyAccess"] = state ? state.noProxyAccess : undefined; resourceInputs["noPublicIp"] = state ? state.noPublicIp : undefined; resourceInputs["noRemoveDataDisk"] = state ? state.noRemoveDataDisk : undefined; resourceInputs["postStartupScript"] = state ? state.postStartupScript : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["proxyUri"] = state ? state.proxyUri : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["reservationAffinity"] = state ? state.reservationAffinity : undefined; resourceInputs["serviceAccount"] = state ? state.serviceAccount : undefined; resourceInputs["serviceAccountScopes"] = state ? state.serviceAccountScopes : undefined; resourceInputs["shieldedInstanceConfig"] = state ? state.shieldedInstanceConfig : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["subnet"] = state ? state.subnet : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["updateTime"] = state ? state.updateTime : undefined; resourceInputs["vmImage"] = state ? state.vmImage : undefined; } else { const args = argsOrState; if ((!args || args.location === undefined) && !opts.urn) { throw new Error("Missing required property 'location'"); } if ((!args || args.machineType === undefined) && !opts.urn) { throw new Error("Missing required property 'machineType'"); } resourceInputs["acceleratorConfig"] = args ? args.acceleratorConfig : undefined; resourceInputs["bootDiskSizeGb"] = args ? args.bootDiskSizeGb : undefined; resourceInputs["bootDiskType"] = args ? args.bootDiskType : undefined; resourceInputs["containerImage"] = args ? args.containerImage : undefined; resourceInputs["createTime"] = args ? args.createTime : undefined; resourceInputs["customGpuDriverPath"] = args ? args.customGpuDriverPath : undefined; resourceInputs["dataDiskSizeGb"] = args ? args.dataDiskSizeGb : undefined; resourceInputs["dataDiskType"] = args ? args.dataDiskType : undefined; resourceInputs["desiredState"] = args ? args.desiredState : undefined; resourceInputs["diskEncryption"] = args ? args.diskEncryption : undefined; resourceInputs["installGpuDriver"] = args ? args.installGpuDriver : undefined; resourceInputs["instanceOwners"] = args ? args.instanceOwners : undefined; resourceInputs["kmsKey"] = args ? args.kmsKey : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["machineType"] = args ? args.machineType : undefined; resourceInputs["metadata"] = args ? args.metadata : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["network"] = args ? args.network : undefined; resourceInputs["nicType"] = args ? args.nicType : undefined; resourceInputs["noProxyAccess"] = args ? args.noProxyAccess : undefined; resourceInputs["noPublicIp"] = args ? args.noPublicIp : undefined; resourceInputs["noRemoveDataDisk"] = args ? args.noRemoveDataDisk : undefined; resourceInputs["postStartupScript"] = args ? args.postStartupScript : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["reservationAffinity"] = args ? args.reservationAffinity : undefined; resourceInputs["serviceAccount"] = args ? args.serviceAccount : undefined; resourceInputs["serviceAccountScopes"] = args ? args.serviceAccountScopes : undefined; resourceInputs["shieldedInstanceConfig"] = args ? args.shieldedInstanceConfig : undefined; resourceInputs["subnet"] = args ? args.subnet : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["updateTime"] = args ? args.updateTime : undefined; resourceInputs["vmImage"] = args ? args.vmImage : undefined; 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; /** @internal */ Instance.__pulumiType = 'gcp:notebooks/instance:Instance'; //# sourceMappingURL=instance.js.map