UNPKG

@pulumi/gcp

Version:

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

387 lines • 13.7 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! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Instance = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * A Workbench instance. * * To get more information about Instance, see: * * * [API documentation](https://cloud.google.com/vertex-ai/docs/workbench/reference/rest/v2/projects.locations.instances) * * How-to Guides * * [Official Documentation](https://cloud.google.com/vertex-ai/docs/workbench/instances/introduction) * * ## Example Usage * * ### Workbench Instance Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.workbench.Instance("instance", { * name: "workbench-instance", * location: "us-west1-a", * }); * ``` * ### Workbench Instance Basic Container * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.workbench.Instance("instance", { * name: "workbench-instance", * location: "us-west1-a", * gceSetup: { * containerImage: { * repository: "us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cu113.py310", * tag: "latest", * }, * }, * }); * ``` * ### Workbench Instance Basic Gpu * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const gpuReservation = new gcp.compute.Reservation("gpu_reservation", { * name: "wbi-reservation", * zone: "us-central1-a", * specificReservation: { * count: 1, * instanceProperties: { * machineType: "n1-standard-1", * guestAccelerators: [{ * acceleratorType: "nvidia-tesla-t4", * acceleratorCount: 1, * }], * }, * }, * specificReservationRequired: false, * }); * const instance = new gcp.workbench.Instance("instance", { * name: "workbench-instance", * location: "us-central1-a", * gceSetup: { * machineType: "n1-standard-1", * acceleratorConfigs: [{ * type: "NVIDIA_TESLA_T4", * coreCount: "1", * }], * vmImage: { * project: "cloud-notebooks-managed", * family: "workbench-instances", * }, * reservationAffinity: { * consumeReservationType: "RESERVATION_ANY", * }, * }, * }, { * dependsOn: [gpuReservation], * }); * ``` * ### Workbench Instance Labels Stopped * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.workbench.Instance("instance", { * name: "workbench-instance", * location: "us-central1-a", * gceSetup: { * machineType: "e2-standard-4", * shieldedInstanceConfig: { * enableSecureBoot: false, * enableVtpm: false, * enableIntegrityMonitoring: false, * }, * serviceAccounts: [{ * email: "my@service-account.com", * }], * metadata: { * terraform: "true", * }, * }, * labels: { * k: "val", * }, * desiredState: "STOPPED", * }); * ``` * ### Workbench Instance Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const myNetwork = new gcp.compute.Network("my_network", { * name: "wbi-test-default", * autoCreateSubnetworks: false, * }); * const mySubnetwork = new gcp.compute.Subnetwork("my_subnetwork", { * name: "wbi-test-default", * network: myNetwork.id, * region: "us-central1", * ipCidrRange: "10.0.1.0/24", * }); * const static = new gcp.compute.Address("static", {name: "wbi-test-default"}); * const actAsPermission = new gcp.serviceaccount.IAMBinding("act_as_permission", { * serviceAccountId: "projects/my-project-name/serviceAccounts/my@service-account.com", * role: "roles/iam.serviceAccountUser", * members: ["user:example@example.com"], * }); * const gpuReservation = new gcp.compute.Reservation("gpu_reservation", { * name: "wbi-reservation", * zone: "us-central1-a", * specificReservation: { * count: 1, * instanceProperties: { * machineType: "n1-standard-4", * guestAccelerators: [{ * acceleratorType: "nvidia-tesla-t4", * acceleratorCount: 1, * }], * }, * }, * specificReservationRequired: true, * }); * const instance = new gcp.workbench.Instance("instance", { * name: "workbench-instance", * location: "us-central1-a", * gceSetup: { * machineType: "n1-standard-4", * acceleratorConfigs: [{ * type: "NVIDIA_TESLA_T4", * coreCount: "1", * }], * shieldedInstanceConfig: { * enableSecureBoot: true, * enableVtpm: true, * enableIntegrityMonitoring: true, * }, * disablePublicIp: false, * serviceAccounts: [{ * email: "my@service-account.com", * }], * bootDisk: { * diskSizeGb: "310", * diskType: "PD_SSD", * diskEncryption: "CMEK", * kmsKey: "my-crypto-key", * }, * dataDisks: { * diskSizeGb: "330", * diskType: "PD_SSD", * diskEncryption: "CMEK", * kmsKey: "my-crypto-key", * }, * networkInterfaces: [{ * network: myNetwork.id, * subnet: mySubnetwork.id, * nicType: "GVNIC", * accessConfigs: [{ * externalIp: static.address, * }], * }], * metadata: { * terraform: "true", * "serial-port-logging-enable": "false", * }, * reservationAffinity: { * consumeReservationType: "RESERVATION_SPECIFIC", * key: "compute.googleapis.com/reservation-name", * values: [gpuReservation.name], * }, * enableIpForwarding: true, * tags: [ * "abc", * "def", * ], * }, * disableProxyAccess: true, * instanceOwners: ["example@example.com"], * labels: { * k: "val", * }, * desiredState: "ACTIVE", * enableThirdPartyIdentity: true, * }, { * dependsOn: [ * myNetwork, * mySubnetwork, * static, * actAsPermission, * gpuReservation, * ], * }); * ``` * ### Workbench Instance Confidential Compute * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const instance = new gcp.workbench.Instance("instance", { * name: "workbench-instance", * location: "us-central1-a", * gceSetup: { * machineType: "n2d-standard-2", * shieldedInstanceConfig: { * enableSecureBoot: true, * enableVtpm: true, * enableIntegrityMonitoring: true, * }, * metadata: { * terraform: "true", * }, * confidentialInstanceConfig: { * confidentialInstanceType: "SEV", * }, * }, * }); * ``` * ### Workbench Instance Euc * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const actAsPermission = new gcp.serviceaccount.IAMBinding("act_as_permission", { * serviceAccountId: "projects/my-project-name/serviceAccounts/1111111111111-compute@developer.gserviceaccount.com", * role: "roles/iam.serviceAccountUser", * members: ["user:example@example.com"], * }); * const instance = new gcp.workbench.Instance("instance", { * name: "workbench-instance", * location: "us-central1-a", * gceSetup: { * machineType: "e2-standard-4", * metadata: { * terraform: "true", * }, * }, * instanceOwners: ["example@example.com"], * enableManagedEuc: true, * }, { * dependsOn: [actAsPermission], * }); * ``` * * ## 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:workbench/instance:Instance default projects/{{project}}/locations/{{location}}/instances/{{name}} * ``` * * ```sh * $ pulumi import gcp:workbench/instance:Instance default {{project}}/{{location}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:workbench/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 }); } /** * 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["createTime"] = state?.createTime; resourceInputs["creator"] = state?.creator; resourceInputs["desiredState"] = state?.desiredState; resourceInputs["disableProxyAccess"] = state?.disableProxyAccess; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["enableManagedEuc"] = state?.enableManagedEuc; resourceInputs["enableThirdPartyIdentity"] = state?.enableThirdPartyIdentity; resourceInputs["gceSetup"] = state?.gceSetup; resourceInputs["healthInfos"] = state?.healthInfos; resourceInputs["healthState"] = state?.healthState; resourceInputs["instanceId"] = state?.instanceId; resourceInputs["instanceOwners"] = state?.instanceOwners; resourceInputs["labels"] = state?.labels; resourceInputs["location"] = state?.location; resourceInputs["name"] = state?.name; resourceInputs["project"] = state?.project; resourceInputs["proxyUri"] = state?.proxyUri; resourceInputs["pulumiLabels"] = state?.pulumiLabels; resourceInputs["state"] = state?.state; resourceInputs["updateTime"] = state?.updateTime; resourceInputs["upgradeHistories"] = state?.upgradeHistories; } else { const args = argsOrState; if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } resourceInputs["desiredState"] = args?.desiredState; resourceInputs["disableProxyAccess"] = args?.disableProxyAccess; resourceInputs["enableManagedEuc"] = args?.enableManagedEuc; resourceInputs["enableThirdPartyIdentity"] = args?.enableThirdPartyIdentity; resourceInputs["gceSetup"] = args?.gceSetup; resourceInputs["instanceId"] = args?.instanceId; resourceInputs["instanceOwners"] = args?.instanceOwners; resourceInputs["labels"] = args?.labels; resourceInputs["location"] = args?.location; resourceInputs["name"] = args?.name; resourceInputs["project"] = args?.project; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["creator"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["healthInfos"] = undefined /*out*/; resourceInputs["healthState"] = undefined /*out*/; resourceInputs["proxyUri"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; resourceInputs["upgradeHistories"] = 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:workbench/instance:Instance'; //# sourceMappingURL=instance.js.map