UNPKG

@pulumi/gcp

Version:

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

292 lines • 11.1 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"); /** * 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 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", * }, * }, * }); * ``` * ### 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 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", * }, * enableIpForwarding: true, * tags: [ * "abc", * "def", * ], * }, * disableProxyAccess: true, * instanceOwners: ["example@example.com"], * labels: { * k: "val", * }, * desiredState: "ACTIVE", * enableThirdPartyIdentity: true, * }, { * dependsOn: [ * myNetwork, * mySubnetwork, * static, * 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, 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["createTime"] = state ? state.createTime : undefined; resourceInputs["creator"] = state ? state.creator : undefined; resourceInputs["desiredState"] = state ? state.desiredState : undefined; resourceInputs["disableProxyAccess"] = state ? state.disableProxyAccess : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["enableThirdPartyIdentity"] = state ? state.enableThirdPartyIdentity : undefined; resourceInputs["gceSetup"] = state ? state.gceSetup : undefined; resourceInputs["healthInfos"] = state ? state.healthInfos : undefined; resourceInputs["healthState"] = state ? state.healthState : undefined; resourceInputs["instanceId"] = state ? state.instanceId : undefined; resourceInputs["instanceOwners"] = state ? state.instanceOwners : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["proxyUri"] = state ? state.proxyUri : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["updateTime"] = state ? state.updateTime : undefined; resourceInputs["upgradeHistories"] = state ? state.upgradeHistories : undefined; } else { const args = argsOrState; if ((!args || args.location === undefined) && !opts.urn) { throw new Error("Missing required property 'location'"); } resourceInputs["desiredState"] = args ? args.desiredState : undefined; resourceInputs["disableProxyAccess"] = args ? args.disableProxyAccess : undefined; resourceInputs["enableThirdPartyIdentity"] = args ? args.enableThirdPartyIdentity : undefined; resourceInputs["gceSetup"] = args ? args.gceSetup : undefined; resourceInputs["instanceId"] = args ? args.instanceId : undefined; resourceInputs["instanceOwners"] = args ? args.instanceOwners : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["project"] = args ? args.project : undefined; 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