UNPKG

@pulumi/gcp

Version:

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

623 lines • 23.9 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.WorkstationConfig = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * ## Example Usage * * ### Workstation Config Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const tagKey1 = new gcp.tags.TagKey("tag_key1", { * parent: "organizations/123456789", * shortName: "keyname", * }); * const tagValue1 = new gcp.tags.TagValue("tag_value1", { * parent: tagKey1.id, * shortName: "valuename", * }); * const _default = new gcp.compute.Network("default", { * name: "workstation-cluster", * autoCreateSubnetworks: false, * }); * const defaultSubnetwork = new gcp.compute.Subnetwork("default", { * name: "workstation-cluster", * ipCidrRange: "10.0.0.0/24", * region: "us-central1", * network: _default.name, * }); * const defaultWorkstationCluster = new gcp.workstations.WorkstationCluster("default", { * workstationClusterId: "workstation-cluster", * network: _default.id, * subnetwork: defaultSubnetwork.id, * location: "us-central1", * labels: { * label: "key", * }, * annotations: { * "label-one": "value-one", * }, * }); * const defaultWorkstationConfig = new gcp.workstations.WorkstationConfig("default", { * workstationConfigId: "workstation-config", * workstationClusterId: defaultWorkstationCluster.workstationClusterId, * location: "us-central1", * idleTimeout: "600s", * runningTimeout: "21600s", * replicaZones: [ * "us-central1-a", * "us-central1-b", * ], * annotations: { * "label-one": "value-one", * }, * labels: { * label: "key", * }, * maxUsableWorkstations: 1, * host: { * gceInstance: { * machineType: "e2-standard-4", * bootDiskSizeGb: 35, * disablePublicIpAddresses: true, * disableSsh: false, * vmTags: pulumi.all([tagKey1.id, tagValue1.id]).apply(([tagKey1Id, tagValue1Id]) => { * [tagKey1Id]: tagValue1Id, * }), * }, * }, * }); * ``` * ### Workstation Config Container * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", { * name: "workstation-cluster", * autoCreateSubnetworks: false, * }); * const defaultSubnetwork = new gcp.compute.Subnetwork("default", { * name: "workstation-cluster", * ipCidrRange: "10.0.0.0/24", * region: "us-central1", * network: _default.name, * }); * const defaultWorkstationCluster = new gcp.workstations.WorkstationCluster("default", { * workstationClusterId: "workstation-cluster", * network: _default.id, * subnetwork: defaultSubnetwork.id, * location: "us-central1", * labels: { * label: "key", * }, * annotations: { * "label-one": "value-one", * }, * }); * const defaultWorkstationConfig = new gcp.workstations.WorkstationConfig("default", { * workstationConfigId: "workstation-config", * workstationClusterId: defaultWorkstationCluster.workstationClusterId, * location: "us-central1", * host: { * gceInstance: { * machineType: "n1-standard-4", * bootDiskSizeGb: 35, * disablePublicIpAddresses: true, * enableNestedVirtualization: true, * }, * }, * container: { * image: "intellij", * env: { * NAME: "FOO", * BABE: "bar", * }, * }, * }); * ``` * ### Workstation Config Persistent Directories * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", { * name: "workstation-cluster", * autoCreateSubnetworks: false, * }); * const defaultSubnetwork = new gcp.compute.Subnetwork("default", { * name: "workstation-cluster", * ipCidrRange: "10.0.0.0/24", * region: "us-central1", * network: _default.name, * }); * const defaultWorkstationCluster = new gcp.workstations.WorkstationCluster("default", { * workstationClusterId: "workstation-cluster", * network: _default.id, * subnetwork: defaultSubnetwork.id, * location: "us-central1", * labels: { * label: "key", * }, * annotations: { * "label-one": "value-one", * }, * }); * const defaultWorkstationConfig = new gcp.workstations.WorkstationConfig("default", { * workstationConfigId: "workstation-config", * workstationClusterId: defaultWorkstationCluster.workstationClusterId, * location: "us-central1", * host: { * gceInstance: { * machineType: "e2-standard-4", * bootDiskSizeGb: 35, * disablePublicIpAddresses: true, * shieldedInstanceConfig: { * enableSecureBoot: true, * enableVtpm: true, * }, * }, * }, * persistentDirectories: [{ * mountPath: "/home", * gcePd: { * sizeGb: 200, * fsType: "ext4", * diskType: "pd-standard", * reclaimPolicy: "DELETE", * }, * }], * }); * ``` * ### Workstation Config Source Snapshot * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", { * name: "workstation-cluster", * autoCreateSubnetworks: false, * }); * const defaultSubnetwork = new gcp.compute.Subnetwork("default", { * name: "workstation-cluster", * ipCidrRange: "10.0.0.0/24", * region: "us-central1", * network: _default.name, * }); * const mySourceDisk = new gcp.compute.Disk("my_source_disk", { * name: "workstation-config", * size: 10, * type: "pd-ssd", * zone: "us-central1-a", * }); * const mySourceSnapshot = new gcp.compute.Snapshot("my_source_snapshot", { * name: "workstation-config", * sourceDisk: mySourceDisk.name, * zone: "us-central1-a", * }); * const defaultWorkstationCluster = new gcp.workstations.WorkstationCluster("default", { * workstationClusterId: "workstation-cluster", * network: _default.id, * subnetwork: defaultSubnetwork.id, * location: "us-central1", * }); * const defaultWorkstationConfig = new gcp.workstations.WorkstationConfig("default", { * workstationConfigId: "workstation-config", * workstationClusterId: defaultWorkstationCluster.workstationClusterId, * location: defaultWorkstationCluster.location, * persistentDirectories: [{ * mountPath: "/home", * gcePd: { * sourceSnapshot: mySourceSnapshot.id, * reclaimPolicy: "DELETE", * }, * }], * }); * ``` * ### Workstation Config Shielded Instance Config * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", { * name: "workstation-cluster", * autoCreateSubnetworks: false, * }); * const defaultSubnetwork = new gcp.compute.Subnetwork("default", { * name: "workstation-cluster", * ipCidrRange: "10.0.0.0/24", * region: "us-central1", * network: _default.name, * }); * const defaultWorkstationCluster = new gcp.workstations.WorkstationCluster("default", { * workstationClusterId: "workstation-cluster", * network: _default.id, * subnetwork: defaultSubnetwork.id, * location: "us-central1", * labels: { * label: "key", * }, * annotations: { * "label-one": "value-one", * }, * }); * const defaultWorkstationConfig = new gcp.workstations.WorkstationConfig("default", { * workstationConfigId: "workstation-config", * workstationClusterId: defaultWorkstationCluster.workstationClusterId, * location: "us-central1", * host: { * gceInstance: { * machineType: "e2-standard-4", * bootDiskSizeGb: 35, * disablePublicIpAddresses: true, * shieldedInstanceConfig: { * enableSecureBoot: true, * enableVtpm: true, * }, * }, * }, * }); * ``` * ### Workstation Config Accelerators * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", { * name: "workstation-cluster", * autoCreateSubnetworks: false, * }); * const defaultSubnetwork = new gcp.compute.Subnetwork("default", { * name: "workstation-cluster", * ipCidrRange: "10.0.0.0/24", * region: "us-central1", * network: _default.name, * }); * const defaultWorkstationCluster = new gcp.workstations.WorkstationCluster("default", { * workstationClusterId: "workstation-cluster", * network: _default.id, * subnetwork: defaultSubnetwork.id, * location: "us-central1", * labels: { * label: "key", * }, * annotations: { * "label-one": "value-one", * }, * }); * const defaultWorkstationConfig = new gcp.workstations.WorkstationConfig("default", { * workstationConfigId: "workstation-config", * workstationClusterId: defaultWorkstationCluster.workstationClusterId, * location: "us-central1", * host: { * gceInstance: { * machineType: "n1-standard-2", * bootDiskSizeGb: 35, * disablePublicIpAddresses: true, * accelerators: [{ * type: "nvidia-tesla-t4", * count: 1, * }], * }, * }, * }); * ``` * ### Workstation Config Boost * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", { * name: "workstation-cluster", * autoCreateSubnetworks: false, * }); * const defaultSubnetwork = new gcp.compute.Subnetwork("default", { * name: "workstation-cluster", * ipCidrRange: "10.0.0.0/24", * region: "us-central1", * network: _default.name, * }); * const defaultWorkstationCluster = new gcp.workstations.WorkstationCluster("default", { * workstationClusterId: "workstation-cluster", * network: _default.id, * subnetwork: defaultSubnetwork.id, * location: "us-central1", * labels: { * label: "key", * }, * annotations: { * "label-one": "value-one", * }, * }); * const defaultWorkstationConfig = new gcp.workstations.WorkstationConfig("default", { * workstationConfigId: "workstation-config", * workstationClusterId: defaultWorkstationCluster.workstationClusterId, * location: "us-central1", * host: { * gceInstance: { * machineType: "e2-standard-4", * bootDiskSizeGb: 35, * disablePublicIpAddresses: true, * boostConfigs: [ * { * id: "boost-1", * machineType: "n1-standard-2", * accelerators: [{ * type: "nvidia-tesla-t4", * count: 1, * }], * }, * { * id: "boost-2", * machineType: "n1-standard-2", * poolSize: 2, * bootDiskSizeGb: 30, * enableNestedVirtualization: true, * }, * ], * }, * }, * }); * ``` * ### Workstation Config Encryption Key * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", { * name: "workstation-cluster", * autoCreateSubnetworks: false, * }); * const defaultSubnetwork = new gcp.compute.Subnetwork("default", { * name: "workstation-cluster", * ipCidrRange: "10.0.0.0/24", * region: "us-central1", * network: _default.name, * }); * const defaultWorkstationCluster = new gcp.workstations.WorkstationCluster("default", { * workstationClusterId: "workstation-cluster", * network: _default.id, * subnetwork: defaultSubnetwork.id, * location: "us-central1", * labels: { * label: "key", * }, * annotations: { * "label-one": "value-one", * }, * }); * const defaultKeyRing = new gcp.kms.KeyRing("default", { * name: "workstation-cluster", * location: "us-central1", * }); * const defaultCryptoKey = new gcp.kms.CryptoKey("default", { * name: "workstation-cluster", * keyRing: defaultKeyRing.id, * }); * const defaultAccount = new gcp.serviceaccount.Account("default", { * accountId: "my-account", * displayName: "Service Account", * }); * const defaultWorkstationConfig = new gcp.workstations.WorkstationConfig("default", { * workstationConfigId: "workstation-config", * workstationClusterId: defaultWorkstationCluster.workstationClusterId, * location: "us-central1", * host: { * gceInstance: { * machineType: "e2-standard-4", * bootDiskSizeGb: 35, * disablePublicIpAddresses: true, * shieldedInstanceConfig: { * enableSecureBoot: true, * enableVtpm: true, * }, * }, * }, * encryptionKey: { * kmsKey: defaultCryptoKey.id, * kmsKeyServiceAccount: defaultAccount.email, * }, * }); * ``` * ### Workstation Config Allowed Ports * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", { * name: "workstation-cluster", * autoCreateSubnetworks: false, * }); * const defaultSubnetwork = new gcp.compute.Subnetwork("default", { * name: "workstation-cluster", * ipCidrRange: "10.0.0.0/24", * region: "us-central1", * network: _default.name, * }); * const defaultWorkstationCluster = new gcp.workstations.WorkstationCluster("default", { * workstationClusterId: "workstation-cluster", * network: _default.id, * subnetwork: defaultSubnetwork.id, * location: "us-central1", * labels: { * label: "key", * }, * annotations: { * "label-one": "value-one", * }, * }); * const defaultWorkstationConfig = new gcp.workstations.WorkstationConfig("default", { * workstationConfigId: "workstation-config", * workstationClusterId: defaultWorkstationCluster.workstationClusterId, * location: "us-central1", * host: { * gceInstance: { * machineType: "e2-standard-4", * bootDiskSizeGb: 35, * disablePublicIpAddresses: true, * }, * }, * allowedPorts: [ * { * first: 80, * last: 80, * }, * { * first: 22, * last: 22, * }, * { * first: 1024, * last: 65535, * }, * ], * }); * ``` * * ## Import * * WorkstationConfig can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/workstationClusters/{{workstation_cluster_id}}/workstationConfigs/{{workstation_config_id}}` * * * `{{project}}/{{location}}/{{workstation_cluster_id}}/{{workstation_config_id}}` * * * `{{location}}/{{workstation_cluster_id}}/{{workstation_config_id}}` * * When using the `pulumi import` command, WorkstationConfig can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:workstations/workstationConfig:WorkstationConfig default projects/{{project}}/locations/{{location}}/workstationClusters/{{workstation_cluster_id}}/workstationConfigs/{{workstation_config_id}} * ``` * * ```sh * $ pulumi import gcp:workstations/workstationConfig:WorkstationConfig default {{project}}/{{location}}/{{workstation_cluster_id}}/{{workstation_config_id}} * ``` * * ```sh * $ pulumi import gcp:workstations/workstationConfig:WorkstationConfig default {{location}}/{{workstation_cluster_id}}/{{workstation_config_id}} * ``` */ class WorkstationConfig extends pulumi.CustomResource { /** * Get an existing WorkstationConfig 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 WorkstationConfig(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of WorkstationConfig. 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'] === WorkstationConfig.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["allowedPorts"] = state ? state.allowedPorts : undefined; resourceInputs["annotations"] = state ? state.annotations : undefined; resourceInputs["conditions"] = state ? state.conditions : undefined; resourceInputs["container"] = state ? state.container : undefined; resourceInputs["createTime"] = state ? state.createTime : undefined; resourceInputs["degraded"] = state ? state.degraded : undefined; resourceInputs["disableTcpConnections"] = state ? state.disableTcpConnections : undefined; resourceInputs["displayName"] = state ? state.displayName : undefined; resourceInputs["effectiveAnnotations"] = state ? state.effectiveAnnotations : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["enableAuditAgent"] = state ? state.enableAuditAgent : undefined; resourceInputs["encryptionKey"] = state ? state.encryptionKey : undefined; resourceInputs["ephemeralDirectories"] = state ? state.ephemeralDirectories : undefined; resourceInputs["etag"] = state ? state.etag : undefined; resourceInputs["host"] = state ? state.host : undefined; resourceInputs["idleTimeout"] = state ? state.idleTimeout : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["maxUsableWorkstations"] = state ? state.maxUsableWorkstations : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["persistentDirectories"] = state ? state.persistentDirectories : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["readinessChecks"] = state ? state.readinessChecks : undefined; resourceInputs["replicaZones"] = state ? state.replicaZones : undefined; resourceInputs["runningTimeout"] = state ? state.runningTimeout : undefined; resourceInputs["uid"] = state ? state.uid : undefined; resourceInputs["workstationClusterId"] = state ? state.workstationClusterId : undefined; resourceInputs["workstationConfigId"] = state ? state.workstationConfigId : undefined; } else { const args = argsOrState; if ((!args || args.location === undefined) && !opts.urn) { throw new Error("Missing required property 'location'"); } if ((!args || args.workstationClusterId === undefined) && !opts.urn) { throw new Error("Missing required property 'workstationClusterId'"); } if ((!args || args.workstationConfigId === undefined) && !opts.urn) { throw new Error("Missing required property 'workstationConfigId'"); } resourceInputs["allowedPorts"] = args ? args.allowedPorts : undefined; resourceInputs["annotations"] = args ? args.annotations : undefined; resourceInputs["container"] = args ? args.container : undefined; resourceInputs["disableTcpConnections"] = args ? args.disableTcpConnections : undefined; resourceInputs["displayName"] = args ? args.displayName : undefined; resourceInputs["enableAuditAgent"] = args ? args.enableAuditAgent : undefined; resourceInputs["encryptionKey"] = args ? args.encryptionKey : undefined; resourceInputs["ephemeralDirectories"] = args ? args.ephemeralDirectories : undefined; resourceInputs["host"] = args ? args.host : undefined; resourceInputs["idleTimeout"] = args ? args.idleTimeout : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["maxUsableWorkstations"] = args ? args.maxUsableWorkstations : undefined; resourceInputs["persistentDirectories"] = args ? args.persistentDirectories : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["readinessChecks"] = args ? args.readinessChecks : undefined; resourceInputs["replicaZones"] = args ? args.replicaZones : undefined; resourceInputs["runningTimeout"] = args ? args.runningTimeout : undefined; resourceInputs["workstationClusterId"] = args ? args.workstationClusterId : undefined; resourceInputs["workstationConfigId"] = args ? args.workstationConfigId : undefined; resourceInputs["conditions"] = undefined /*out*/; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["degraded"] = undefined /*out*/; resourceInputs["effectiveAnnotations"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["etag"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["uid"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(WorkstationConfig.__pulumiType, name, resourceInputs, opts); } } exports.WorkstationConfig = WorkstationConfig; /** @internal */ WorkstationConfig.__pulumiType = 'gcp:workstations/workstationConfig:WorkstationConfig'; //# sourceMappingURL=workstationConfig.js.map