Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.workstations.kotlin.WorkstationConfig.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.workstations.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigCondition
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigContainer
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigEncryptionKey
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigEphemeralDirectory
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigHost
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigPersistentDirectory
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigReadinessCheck
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigCondition.Companion.toKotlin as workstationConfigConditionToKotlin
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigContainer.Companion.toKotlin as workstationConfigContainerToKotlin
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigEncryptionKey.Companion.toKotlin as workstationConfigEncryptionKeyToKotlin
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigEphemeralDirectory.Companion.toKotlin as workstationConfigEphemeralDirectoryToKotlin
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigHost.Companion.toKotlin as workstationConfigHostToKotlin
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigPersistentDirectory.Companion.toKotlin as workstationConfigPersistentDirectoryToKotlin
import com.pulumi.gcp.workstations.kotlin.outputs.WorkstationConfigReadinessCheck.Companion.toKotlin as workstationConfigReadinessCheckToKotlin
/**
* Builder for [WorkstationConfig].
*/
@PulumiTagMarker
public class WorkstationConfigResourceBuilder internal constructor() {
public var name: String? = null
public var args: WorkstationConfigArgs = WorkstationConfigArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend WorkstationConfigArgsBuilder.() -> Unit) {
val builder = WorkstationConfigArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): WorkstationConfig {
val builtJavaResource = com.pulumi.gcp.workstations.WorkstationConfig(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return WorkstationConfig(builtJavaResource)
}
}
/**
* ## 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: pulumi.interpolate`tagKeys/${tagKey1.name}`,
* 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",
* },
* host: {
* gceInstance: {
* machineType: "e2-standard-4",
* bootDiskSizeGb: 35,
* disablePublicIpAddresses: true,
* disableSsh: false,
* vmTags: pulumi.all([tagKey1.name, tagValue1.name]).apply(([tagKey1Name, tagValue1Name]) => {
* [`tagKeys/${tagKey1Name}`]: `tagValues/${tagValue1Name}`,
* }),
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* tag_key1 = gcp.tags.TagKey("tag_key1",
* parent="organizations/123456789",
* short_name="keyname")
* tag_value1 = gcp.tags.TagValue("tag_value1",
* parent=tag_key1.name.apply(lambda name: f"tagKeys/{name}"),
* short_name="valuename")
* default = gcp.compute.Network("default",
* name="workstation-cluster",
* auto_create_subnetworks=False)
* default_subnetwork = gcp.compute.Subnetwork("default",
* name="workstation-cluster",
* ip_cidr_range="10.0.0.0/24",
* region="us-central1",
* network=default.name)
* default_workstation_cluster = gcp.workstations.WorkstationCluster("default",
* workstation_cluster_id="workstation-cluster",
* network=default.id,
* subnetwork=default_subnetwork.id,
* location="us-central1",
* labels={
* "label": "key",
* },
* annotations={
* "label-one": "value-one",
* })
* default_workstation_config = gcp.workstations.WorkstationConfig("default",
* workstation_config_id="workstation-config",
* workstation_cluster_id=default_workstation_cluster.workstation_cluster_id,
* location="us-central1",
* idle_timeout="600s",
* running_timeout="21600s",
* replica_zones=[
* "us-central1-a",
* "us-central1-b",
* ],
* annotations={
* "label-one": "value-one",
* },
* labels={
* "label": "key",
* },
* host={
* "gce_instance": {
* "machine_type": "e2-standard-4",
* "boot_disk_size_gb": 35,
* "disable_public_ip_addresses": True,
* "disable_ssh": False,
* "vm_tags": pulumi.Output.all(
* tagKey1Name=tag_key1.name,
* tagValue1Name=tag_value1.name
* ).apply(lambda resolved_outputs: {
* "": f"tagValues/{resolved_outputs['tagValue1Name']}",
* })
* ,
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var tagKey1 = new Gcp.Tags.TagKey("tag_key1", new()
* {
* Parent = "organizations/123456789",
* ShortName = "keyname",
* });
* var tagValue1 = new Gcp.Tags.TagValue("tag_value1", new()
* {
* Parent = tagKey1.Name.Apply(name => $"tagKeys/{name}"),
* ShortName = "valuename",
* });
* var @default = new Gcp.Compute.Network("default", new()
* {
* Name = "workstation-cluster",
* AutoCreateSubnetworks = false,
* });
* var defaultSubnetwork = new Gcp.Compute.Subnetwork("default", new()
* {
* Name = "workstation-cluster",
* IpCidrRange = "10.0.0.0/24",
* Region = "us-central1",
* Network = @default.Name,
* });
* var defaultWorkstationCluster = new Gcp.Workstations.WorkstationCluster("default", new()
* {
* WorkstationClusterId = "workstation-cluster",
* Network = @default.Id,
* Subnetwork = defaultSubnetwork.Id,
* Location = "us-central1",
* Labels =
* {
* { "label", "key" },
* },
* Annotations =
* {
* { "label-one", "value-one" },
* },
* });
* var defaultWorkstationConfig = new Gcp.Workstations.WorkstationConfig("default", new()
* {
* WorkstationConfigId = "workstation-config",
* WorkstationClusterId = defaultWorkstationCluster.WorkstationClusterId,
* Location = "us-central1",
* IdleTimeout = "600s",
* RunningTimeout = "21600s",
* ReplicaZones = new[]
* {
* "us-central1-a",
* "us-central1-b",
* },
* Annotations =
* {
* { "label-one", "value-one" },
* },
* Labels =
* {
* { "label", "key" },
* },
* Host = new Gcp.Workstations.Inputs.WorkstationConfigHostArgs
* {
* GceInstance = new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceArgs
* {
* MachineType = "e2-standard-4",
* BootDiskSizeGb = 35,
* DisablePublicIpAddresses = true,
* DisableSsh = false,
* VmTags = Output.Tuple(tagKey1.Name, tagValue1.Name).Apply(values =>
* {
* var tagKey1Name = values.Item1;
* var tagValue1Name = values.Item2;
* return
* {
* { $"tagKeys/{tagKey1Name}", $"tagValues/{tagValue1Name}" },
* };
* }),
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/tags"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workstations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* tagKey1, err := tags.NewTagKey(ctx, "tag_key1", &tags.TagKeyArgs{
* Parent: pulumi.String("organizations/123456789"),
* ShortName: pulumi.String("keyname"),
* })
* if err != nil {
* return err
* }
* tagValue1, err := tags.NewTagValue(ctx, "tag_value1", &tags.TagValueArgs{
* Parent: tagKey1.Name.ApplyT(func(name string) (string, error) {
* return fmt.Sprintf("tagKeys/%v", name), nil
* }).(pulumi.StringOutput),
* ShortName: pulumi.String("valuename"),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* defaultSubnetwork, err := compute.NewSubnetwork(ctx, "default", &compute.SubnetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* IpCidrRange: pulumi.String("10.0.0.0/24"),
* Region: pulumi.String("us-central1"),
* Network: _default.Name,
* })
* if err != nil {
* return err
* }
* defaultWorkstationCluster, err := workstations.NewWorkstationCluster(ctx, "default", &workstations.WorkstationClusterArgs{
* WorkstationClusterId: pulumi.String("workstation-cluster"),
* Network: _default.ID(),
* Subnetwork: defaultSubnetwork.ID(),
* Location: pulumi.String("us-central1"),
* Labels: pulumi.StringMap{
* "label": pulumi.String("key"),
* },
* Annotations: pulumi.StringMap{
* "label-one": pulumi.String("value-one"),
* },
* })
* if err != nil {
* return err
* }
* _, err = workstations.NewWorkstationConfig(ctx, "default", &workstations.WorkstationConfigArgs{
* WorkstationConfigId: pulumi.String("workstation-config"),
* WorkstationClusterId: defaultWorkstationCluster.WorkstationClusterId,
* Location: pulumi.String("us-central1"),
* IdleTimeout: pulumi.String("600s"),
* RunningTimeout: pulumi.String("21600s"),
* ReplicaZones: pulumi.StringArray{
* pulumi.String("us-central1-a"),
* pulumi.String("us-central1-b"),
* },
* Annotations: pulumi.StringMap{
* "label-one": pulumi.String("value-one"),
* },
* Labels: pulumi.StringMap{
* "label": pulumi.String("key"),
* },
* Host: &workstations.WorkstationConfigHostArgs{
* GceInstance: &workstations.WorkstationConfigHostGceInstanceArgs{
* MachineType: pulumi.String("e2-standard-4"),
* BootDiskSizeGb: pulumi.Int(35),
* DisablePublicIpAddresses: pulumi.Bool(true),
* DisableSsh: pulumi.Bool(false),
* VmTags: pulumi.All(tagKey1.Name,tagValue1.Name).ApplyT(func(_args []interface{}) (map[string]string, error) {
* tagKey1Name := _args[0].(string)
* tagValue1Name := _args[1].(string)
* return map[string]string{
* fmt.Sprintf("tagKeys/%v", tagKey1Name): fmt.Sprintf("tagValues/%v", tagValue1Name),
* }, nil
* }).(pulumi.Map[string]stringOutput),
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.tags.TagKey;
* import com.pulumi.gcp.tags.TagKeyArgs;
* import com.pulumi.gcp.tags.TagValue;
* import com.pulumi.gcp.tags.TagValueArgs;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.workstations.WorkstationCluster;
* import com.pulumi.gcp.workstations.WorkstationClusterArgs;
* import com.pulumi.gcp.workstations.WorkstationConfig;
* import com.pulumi.gcp.workstations.WorkstationConfigArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostGceInstanceArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var tagKey1 = new TagKey("tagKey1", TagKeyArgs.builder()
* .parent("organizations/123456789")
* .shortName("keyname")
* .build());
* var tagValue1 = new TagValue("tagValue1", TagValueArgs.builder()
* .parent(tagKey1.name().applyValue(name -> String.format("tagKeys/%s", name)))
* .shortName("valuename")
* .build());
* var default_ = new Network("default", NetworkArgs.builder()
* .name("workstation-cluster")
* .autoCreateSubnetworks(false)
* .build());
* var defaultSubnetwork = new Subnetwork("defaultSubnetwork", SubnetworkArgs.builder()
* .name("workstation-cluster")
* .ipCidrRange("10.0.0.0/24")
* .region("us-central1")
* .network(default_.name())
* .build());
* var defaultWorkstationCluster = new WorkstationCluster("defaultWorkstationCluster", WorkstationClusterArgs.builder()
* .workstationClusterId("workstation-cluster")
* .network(default_.id())
* .subnetwork(defaultSubnetwork.id())
* .location("us-central1")
* .labels(Map.of("label", "key"))
* .annotations(Map.of("label-one", "value-one"))
* .build());
* var defaultWorkstationConfig = new WorkstationConfig("defaultWorkstationConfig", WorkstationConfigArgs.builder()
* .workstationConfigId("workstation-config")
* .workstationClusterId(defaultWorkstationCluster.workstationClusterId())
* .location("us-central1")
* .idleTimeout("600s")
* .runningTimeout("21600s")
* .replicaZones(
* "us-central1-a",
* "us-central1-b")
* .annotations(Map.of("label-one", "value-one"))
* .labels(Map.of("label", "key"))
* .host(WorkstationConfigHostArgs.builder()
* .gceInstance(WorkstationConfigHostGceInstanceArgs.builder()
* .machineType("e2-standard-4")
* .bootDiskSizeGb(35)
* .disablePublicIpAddresses(true)
* .disableSsh(false)
* .vmTags(Output.tuple(tagKey1.name(), tagValue1.name()).applyValue(values -> {
* var tagKey1Name = values.t1;
* var tagValue1Name = values.t2;
* return Map.of(String.format("tagKeys/%s", tagKey1Name), String.format("tagValues/%s", tagValue1Name));
* }))
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* tagKey1:
* type: gcp:tags:TagKey
* name: tag_key1
* properties:
* parent: organizations/123456789
* shortName: keyname
* tagValue1:
* type: gcp:tags:TagValue
* name: tag_value1
* properties:
* parent: tagKeys/${tagKey1.name}
* shortName: valuename
* default:
* type: gcp:compute:Network
* properties:
* name: workstation-cluster
* autoCreateSubnetworks: false
* defaultSubnetwork:
* type: gcp:compute:Subnetwork
* name: default
* properties:
* name: workstation-cluster
* ipCidrRange: 10.0.0.0/24
* region: us-central1
* network: ${default.name}
* defaultWorkstationCluster:
* type: gcp:workstations:WorkstationCluster
* name: default
* properties:
* workstationClusterId: workstation-cluster
* network: ${default.id}
* subnetwork: ${defaultSubnetwork.id}
* location: us-central1
* labels:
* label: key
* annotations:
* label-one: value-one
* defaultWorkstationConfig:
* type: gcp:workstations:WorkstationConfig
* name: default
* properties:
* 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
* host:
* gceInstance:
* machineType: e2-standard-4
* bootDiskSizeGb: 35
* disablePublicIpAddresses: true
* disableSsh: false
* vmTags:
* tagKeys/${tagKey1.name}: tagValues/${tagValue1.name}
* ```
*
* ### 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",
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.compute.Network("default",
* name="workstation-cluster",
* auto_create_subnetworks=False)
* default_subnetwork = gcp.compute.Subnetwork("default",
* name="workstation-cluster",
* ip_cidr_range="10.0.0.0/24",
* region="us-central1",
* network=default.name)
* default_workstation_cluster = gcp.workstations.WorkstationCluster("default",
* workstation_cluster_id="workstation-cluster",
* network=default.id,
* subnetwork=default_subnetwork.id,
* location="us-central1",
* labels={
* "label": "key",
* },
* annotations={
* "label-one": "value-one",
* })
* default_workstation_config = gcp.workstations.WorkstationConfig("default",
* workstation_config_id="workstation-config",
* workstation_cluster_id=default_workstation_cluster.workstation_cluster_id,
* location="us-central1",
* host={
* "gce_instance": {
* "machine_type": "n1-standard-4",
* "boot_disk_size_gb": 35,
* "disable_public_ip_addresses": True,
* "enable_nested_virtualization": True,
* },
* },
* container={
* "image": "intellij",
* "env": {
* "name": "FOO",
* "babe": "bar",
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.Compute.Network("default", new()
* {
* Name = "workstation-cluster",
* AutoCreateSubnetworks = false,
* });
* var defaultSubnetwork = new Gcp.Compute.Subnetwork("default", new()
* {
* Name = "workstation-cluster",
* IpCidrRange = "10.0.0.0/24",
* Region = "us-central1",
* Network = @default.Name,
* });
* var defaultWorkstationCluster = new Gcp.Workstations.WorkstationCluster("default", new()
* {
* WorkstationClusterId = "workstation-cluster",
* Network = @default.Id,
* Subnetwork = defaultSubnetwork.Id,
* Location = "us-central1",
* Labels =
* {
* { "label", "key" },
* },
* Annotations =
* {
* { "label-one", "value-one" },
* },
* });
* var defaultWorkstationConfig = new Gcp.Workstations.WorkstationConfig("default", new()
* {
* WorkstationConfigId = "workstation-config",
* WorkstationClusterId = defaultWorkstationCluster.WorkstationClusterId,
* Location = "us-central1",
* Host = new Gcp.Workstations.Inputs.WorkstationConfigHostArgs
* {
* GceInstance = new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceArgs
* {
* MachineType = "n1-standard-4",
* BootDiskSizeGb = 35,
* DisablePublicIpAddresses = true,
* EnableNestedVirtualization = true,
* },
* },
* Container = new Gcp.Workstations.Inputs.WorkstationConfigContainerArgs
* {
* Image = "intellij",
* Env =
* {
* { "NAME", "FOO" },
* { "BABE", "bar" },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workstations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* defaultSubnetwork, err := compute.NewSubnetwork(ctx, "default", &compute.SubnetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* IpCidrRange: pulumi.String("10.0.0.0/24"),
* Region: pulumi.String("us-central1"),
* Network: _default.Name,
* })
* if err != nil {
* return err
* }
* defaultWorkstationCluster, err := workstations.NewWorkstationCluster(ctx, "default", &workstations.WorkstationClusterArgs{
* WorkstationClusterId: pulumi.String("workstation-cluster"),
* Network: _default.ID(),
* Subnetwork: defaultSubnetwork.ID(),
* Location: pulumi.String("us-central1"),
* Labels: pulumi.StringMap{
* "label": pulumi.String("key"),
* },
* Annotations: pulumi.StringMap{
* "label-one": pulumi.String("value-one"),
* },
* })
* if err != nil {
* return err
* }
* _, err = workstations.NewWorkstationConfig(ctx, "default", &workstations.WorkstationConfigArgs{
* WorkstationConfigId: pulumi.String("workstation-config"),
* WorkstationClusterId: defaultWorkstationCluster.WorkstationClusterId,
* Location: pulumi.String("us-central1"),
* Host: &workstations.WorkstationConfigHostArgs{
* GceInstance: &workstations.WorkstationConfigHostGceInstanceArgs{
* MachineType: pulumi.String("n1-standard-4"),
* BootDiskSizeGb: pulumi.Int(35),
* DisablePublicIpAddresses: pulumi.Bool(true),
* EnableNestedVirtualization: pulumi.Bool(true),
* },
* },
* Container: &workstations.WorkstationConfigContainerArgs{
* Image: pulumi.String("intellij"),
* Env: pulumi.StringMap{
* "NAME": pulumi.String("FOO"),
* "BABE": pulumi.String("bar"),
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.workstations.WorkstationCluster;
* import com.pulumi.gcp.workstations.WorkstationClusterArgs;
* import com.pulumi.gcp.workstations.WorkstationConfig;
* import com.pulumi.gcp.workstations.WorkstationConfigArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostGceInstanceArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigContainerArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var default_ = new Network("default", NetworkArgs.builder()
* .name("workstation-cluster")
* .autoCreateSubnetworks(false)
* .build());
* var defaultSubnetwork = new Subnetwork("defaultSubnetwork", SubnetworkArgs.builder()
* .name("workstation-cluster")
* .ipCidrRange("10.0.0.0/24")
* .region("us-central1")
* .network(default_.name())
* .build());
* var defaultWorkstationCluster = new WorkstationCluster("defaultWorkstationCluster", WorkstationClusterArgs.builder()
* .workstationClusterId("workstation-cluster")
* .network(default_.id())
* .subnetwork(defaultSubnetwork.id())
* .location("us-central1")
* .labels(Map.of("label", "key"))
* .annotations(Map.of("label-one", "value-one"))
* .build());
* var defaultWorkstationConfig = new WorkstationConfig("defaultWorkstationConfig", WorkstationConfigArgs.builder()
* .workstationConfigId("workstation-config")
* .workstationClusterId(defaultWorkstationCluster.workstationClusterId())
* .location("us-central1")
* .host(WorkstationConfigHostArgs.builder()
* .gceInstance(WorkstationConfigHostGceInstanceArgs.builder()
* .machineType("n1-standard-4")
* .bootDiskSizeGb(35)
* .disablePublicIpAddresses(true)
* .enableNestedVirtualization(true)
* .build())
* .build())
* .container(WorkstationConfigContainerArgs.builder()
* .image("intellij")
* .env(Map.ofEntries(
* Map.entry("NAME", "FOO"),
* Map.entry("BABE", "bar")
* ))
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:Network
* properties:
* name: workstation-cluster
* autoCreateSubnetworks: false
* defaultSubnetwork:
* type: gcp:compute:Subnetwork
* name: default
* properties:
* name: workstation-cluster
* ipCidrRange: 10.0.0.0/24
* region: us-central1
* network: ${default.name}
* defaultWorkstationCluster:
* type: gcp:workstations:WorkstationCluster
* name: default
* properties:
* workstationClusterId: workstation-cluster
* network: ${default.id}
* subnetwork: ${defaultSubnetwork.id}
* location: us-central1
* labels:
* label: key
* annotations:
* label-one: value-one
* defaultWorkstationConfig:
* type: gcp:workstations:WorkstationConfig
* name: default
* properties:
* 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",
* },
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.compute.Network("default",
* name="workstation-cluster",
* auto_create_subnetworks=False)
* default_subnetwork = gcp.compute.Subnetwork("default",
* name="workstation-cluster",
* ip_cidr_range="10.0.0.0/24",
* region="us-central1",
* network=default.name)
* default_workstation_cluster = gcp.workstations.WorkstationCluster("default",
* workstation_cluster_id="workstation-cluster",
* network=default.id,
* subnetwork=default_subnetwork.id,
* location="us-central1",
* labels={
* "label": "key",
* },
* annotations={
* "label-one": "value-one",
* })
* default_workstation_config = gcp.workstations.WorkstationConfig("default",
* workstation_config_id="workstation-config",
* workstation_cluster_id=default_workstation_cluster.workstation_cluster_id,
* location="us-central1",
* host={
* "gce_instance": {
* "machine_type": "e2-standard-4",
* "boot_disk_size_gb": 35,
* "disable_public_ip_addresses": True,
* "shielded_instance_config": {
* "enable_secure_boot": True,
* "enable_vtpm": True,
* },
* },
* },
* persistent_directories=[{
* "mount_path": "/home",
* "gce_pd": {
* "size_gb": 200,
* "fs_type": "ext4",
* "disk_type": "pd-standard",
* "reclaim_policy": "DELETE",
* },
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.Compute.Network("default", new()
* {
* Name = "workstation-cluster",
* AutoCreateSubnetworks = false,
* });
* var defaultSubnetwork = new Gcp.Compute.Subnetwork("default", new()
* {
* Name = "workstation-cluster",
* IpCidrRange = "10.0.0.0/24",
* Region = "us-central1",
* Network = @default.Name,
* });
* var defaultWorkstationCluster = new Gcp.Workstations.WorkstationCluster("default", new()
* {
* WorkstationClusterId = "workstation-cluster",
* Network = @default.Id,
* Subnetwork = defaultSubnetwork.Id,
* Location = "us-central1",
* Labels =
* {
* { "label", "key" },
* },
* Annotations =
* {
* { "label-one", "value-one" },
* },
* });
* var defaultWorkstationConfig = new Gcp.Workstations.WorkstationConfig("default", new()
* {
* WorkstationConfigId = "workstation-config",
* WorkstationClusterId = defaultWorkstationCluster.WorkstationClusterId,
* Location = "us-central1",
* Host = new Gcp.Workstations.Inputs.WorkstationConfigHostArgs
* {
* GceInstance = new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceArgs
* {
* MachineType = "e2-standard-4",
* BootDiskSizeGb = 35,
* DisablePublicIpAddresses = true,
* ShieldedInstanceConfig = new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceShieldedInstanceConfigArgs
* {
* EnableSecureBoot = true,
* EnableVtpm = true,
* },
* },
* },
* PersistentDirectories = new[]
* {
* new Gcp.Workstations.Inputs.WorkstationConfigPersistentDirectoryArgs
* {
* MountPath = "/home",
* GcePd = new Gcp.Workstations.Inputs.WorkstationConfigPersistentDirectoryGcePdArgs
* {
* SizeGb = 200,
* FsType = "ext4",
* DiskType = "pd-standard",
* ReclaimPolicy = "DELETE",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workstations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* defaultSubnetwork, err := compute.NewSubnetwork(ctx, "default", &compute.SubnetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* IpCidrRange: pulumi.String("10.0.0.0/24"),
* Region: pulumi.String("us-central1"),
* Network: _default.Name,
* })
* if err != nil {
* return err
* }
* defaultWorkstationCluster, err := workstations.NewWorkstationCluster(ctx, "default", &workstations.WorkstationClusterArgs{
* WorkstationClusterId: pulumi.String("workstation-cluster"),
* Network: _default.ID(),
* Subnetwork: defaultSubnetwork.ID(),
* Location: pulumi.String("us-central1"),
* Labels: pulumi.StringMap{
* "label": pulumi.String("key"),
* },
* Annotations: pulumi.StringMap{
* "label-one": pulumi.String("value-one"),
* },
* })
* if err != nil {
* return err
* }
* _, err = workstations.NewWorkstationConfig(ctx, "default", &workstations.WorkstationConfigArgs{
* WorkstationConfigId: pulumi.String("workstation-config"),
* WorkstationClusterId: defaultWorkstationCluster.WorkstationClusterId,
* Location: pulumi.String("us-central1"),
* Host: &workstations.WorkstationConfigHostArgs{
* GceInstance: &workstations.WorkstationConfigHostGceInstanceArgs{
* MachineType: pulumi.String("e2-standard-4"),
* BootDiskSizeGb: pulumi.Int(35),
* DisablePublicIpAddresses: pulumi.Bool(true),
* ShieldedInstanceConfig: &workstations.WorkstationConfigHostGceInstanceShieldedInstanceConfigArgs{
* EnableSecureBoot: pulumi.Bool(true),
* EnableVtpm: pulumi.Bool(true),
* },
* },
* },
* PersistentDirectories: workstations.WorkstationConfigPersistentDirectoryArray{
* &workstations.WorkstationConfigPersistentDirectoryArgs{
* MountPath: pulumi.String("/home"),
* GcePd: &workstations.WorkstationConfigPersistentDirectoryGcePdArgs{
* SizeGb: pulumi.Int(200),
* FsType: pulumi.String("ext4"),
* DiskType: pulumi.String("pd-standard"),
* ReclaimPolicy: pulumi.String("DELETE"),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.workstations.WorkstationCluster;
* import com.pulumi.gcp.workstations.WorkstationClusterArgs;
* import com.pulumi.gcp.workstations.WorkstationConfig;
* import com.pulumi.gcp.workstations.WorkstationConfigArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostGceInstanceArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostGceInstanceShieldedInstanceConfigArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigPersistentDirectoryArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigPersistentDirectoryGcePdArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var default_ = new Network("default", NetworkArgs.builder()
* .name("workstation-cluster")
* .autoCreateSubnetworks(false)
* .build());
* var defaultSubnetwork = new Subnetwork("defaultSubnetwork", SubnetworkArgs.builder()
* .name("workstation-cluster")
* .ipCidrRange("10.0.0.0/24")
* .region("us-central1")
* .network(default_.name())
* .build());
* var defaultWorkstationCluster = new WorkstationCluster("defaultWorkstationCluster", WorkstationClusterArgs.builder()
* .workstationClusterId("workstation-cluster")
* .network(default_.id())
* .subnetwork(defaultSubnetwork.id())
* .location("us-central1")
* .labels(Map.of("label", "key"))
* .annotations(Map.of("label-one", "value-one"))
* .build());
* var defaultWorkstationConfig = new WorkstationConfig("defaultWorkstationConfig", WorkstationConfigArgs.builder()
* .workstationConfigId("workstation-config")
* .workstationClusterId(defaultWorkstationCluster.workstationClusterId())
* .location("us-central1")
* .host(WorkstationConfigHostArgs.builder()
* .gceInstance(WorkstationConfigHostGceInstanceArgs.builder()
* .machineType("e2-standard-4")
* .bootDiskSizeGb(35)
* .disablePublicIpAddresses(true)
* .shieldedInstanceConfig(WorkstationConfigHostGceInstanceShieldedInstanceConfigArgs.builder()
* .enableSecureBoot(true)
* .enableVtpm(true)
* .build())
* .build())
* .build())
* .persistentDirectories(WorkstationConfigPersistentDirectoryArgs.builder()
* .mountPath("/home")
* .gcePd(WorkstationConfigPersistentDirectoryGcePdArgs.builder()
* .sizeGb(200)
* .fsType("ext4")
* .diskType("pd-standard")
* .reclaimPolicy("DELETE")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:Network
* properties:
* name: workstation-cluster
* autoCreateSubnetworks: false
* defaultSubnetwork:
* type: gcp:compute:Subnetwork
* name: default
* properties:
* name: workstation-cluster
* ipCidrRange: 10.0.0.0/24
* region: us-central1
* network: ${default.name}
* defaultWorkstationCluster:
* type: gcp:workstations:WorkstationCluster
* name: default
* properties:
* workstationClusterId: workstation-cluster
* network: ${default.id}
* subnetwork: ${defaultSubnetwork.id}
* location: us-central1
* labels:
* label: key
* annotations:
* label-one: value-one
* defaultWorkstationConfig:
* type: gcp:workstations:WorkstationConfig
* name: default
* properties:
* 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",
* },
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.compute.Network("default",
* name="workstation-cluster",
* auto_create_subnetworks=False)
* default_subnetwork = gcp.compute.Subnetwork("default",
* name="workstation-cluster",
* ip_cidr_range="10.0.0.0/24",
* region="us-central1",
* network=default.name)
* my_source_disk = gcp.compute.Disk("my_source_disk",
* name="workstation-config",
* size=10,
* type="pd-ssd",
* zone="us-central1-a")
* my_source_snapshot = gcp.compute.Snapshot("my_source_snapshot",
* name="workstation-config",
* source_disk=my_source_disk.name,
* zone="us-central1-a")
* default_workstation_cluster = gcp.workstations.WorkstationCluster("default",
* workstation_cluster_id="workstation-cluster",
* network=default.id,
* subnetwork=default_subnetwork.id,
* location="us-central1")
* default_workstation_config = gcp.workstations.WorkstationConfig("default",
* workstation_config_id="workstation-config",
* workstation_cluster_id=default_workstation_cluster.workstation_cluster_id,
* location=default_workstation_cluster.location,
* persistent_directories=[{
* "mount_path": "/home",
* "gce_pd": {
* "source_snapshot": my_source_snapshot.id,
* "reclaim_policy": "DELETE",
* },
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.Compute.Network("default", new()
* {
* Name = "workstation-cluster",
* AutoCreateSubnetworks = false,
* });
* var defaultSubnetwork = new Gcp.Compute.Subnetwork("default", new()
* {
* Name = "workstation-cluster",
* IpCidrRange = "10.0.0.0/24",
* Region = "us-central1",
* Network = @default.Name,
* });
* var mySourceDisk = new Gcp.Compute.Disk("my_source_disk", new()
* {
* Name = "workstation-config",
* Size = 10,
* Type = "pd-ssd",
* Zone = "us-central1-a",
* });
* var mySourceSnapshot = new Gcp.Compute.Snapshot("my_source_snapshot", new()
* {
* Name = "workstation-config",
* SourceDisk = mySourceDisk.Name,
* Zone = "us-central1-a",
* });
* var defaultWorkstationCluster = new Gcp.Workstations.WorkstationCluster("default", new()
* {
* WorkstationClusterId = "workstation-cluster",
* Network = @default.Id,
* Subnetwork = defaultSubnetwork.Id,
* Location = "us-central1",
* });
* var defaultWorkstationConfig = new Gcp.Workstations.WorkstationConfig("default", new()
* {
* WorkstationConfigId = "workstation-config",
* WorkstationClusterId = defaultWorkstationCluster.WorkstationClusterId,
* Location = defaultWorkstationCluster.Location,
* PersistentDirectories = new[]
* {
* new Gcp.Workstations.Inputs.WorkstationConfigPersistentDirectoryArgs
* {
* MountPath = "/home",
* GcePd = new Gcp.Workstations.Inputs.WorkstationConfigPersistentDirectoryGcePdArgs
* {
* SourceSnapshot = mySourceSnapshot.Id,
* ReclaimPolicy = "DELETE",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workstations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* defaultSubnetwork, err := compute.NewSubnetwork(ctx, "default", &compute.SubnetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* IpCidrRange: pulumi.String("10.0.0.0/24"),
* Region: pulumi.String("us-central1"),
* Network: _default.Name,
* })
* if err != nil {
* return err
* }
* mySourceDisk, err := compute.NewDisk(ctx, "my_source_disk", &compute.DiskArgs{
* Name: pulumi.String("workstation-config"),
* Size: pulumi.Int(10),
* Type: pulumi.String("pd-ssd"),
* Zone: pulumi.String("us-central1-a"),
* })
* if err != nil {
* return err
* }
* mySourceSnapshot, err := compute.NewSnapshot(ctx, "my_source_snapshot", &compute.SnapshotArgs{
* Name: pulumi.String("workstation-config"),
* SourceDisk: mySourceDisk.Name,
* Zone: pulumi.String("us-central1-a"),
* })
* if err != nil {
* return err
* }
* defaultWorkstationCluster, err := workstations.NewWorkstationCluster(ctx, "default", &workstations.WorkstationClusterArgs{
* WorkstationClusterId: pulumi.String("workstation-cluster"),
* Network: _default.ID(),
* Subnetwork: defaultSubnetwork.ID(),
* Location: pulumi.String("us-central1"),
* })
* if err != nil {
* return err
* }
* _, err = workstations.NewWorkstationConfig(ctx, "default", &workstations.WorkstationConfigArgs{
* WorkstationConfigId: pulumi.String("workstation-config"),
* WorkstationClusterId: defaultWorkstationCluster.WorkstationClusterId,
* Location: defaultWorkstationCluster.Location,
* PersistentDirectories: workstations.WorkstationConfigPersistentDirectoryArray{
* &workstations.WorkstationConfigPersistentDirectoryArgs{
* MountPath: pulumi.String("/home"),
* GcePd: &workstations.WorkstationConfigPersistentDirectoryGcePdArgs{
* SourceSnapshot: mySourceSnapshot.ID(),
* ReclaimPolicy: pulumi.String("DELETE"),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.compute.Disk;
* import com.pulumi.gcp.compute.DiskArgs;
* import com.pulumi.gcp.compute.Snapshot;
* import com.pulumi.gcp.compute.SnapshotArgs;
* import com.pulumi.gcp.workstations.WorkstationCluster;
* import com.pulumi.gcp.workstations.WorkstationClusterArgs;
* import com.pulumi.gcp.workstations.WorkstationConfig;
* import com.pulumi.gcp.workstations.WorkstationConfigArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigPersistentDirectoryArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigPersistentDirectoryGcePdArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var default_ = new Network("default", NetworkArgs.builder()
* .name("workstation-cluster")
* .autoCreateSubnetworks(false)
* .build());
* var defaultSubnetwork = new Subnetwork("defaultSubnetwork", SubnetworkArgs.builder()
* .name("workstation-cluster")
* .ipCidrRange("10.0.0.0/24")
* .region("us-central1")
* .network(default_.name())
* .build());
* var mySourceDisk = new Disk("mySourceDisk", DiskArgs.builder()
* .name("workstation-config")
* .size(10)
* .type("pd-ssd")
* .zone("us-central1-a")
* .build());
* var mySourceSnapshot = new Snapshot("mySourceSnapshot", SnapshotArgs.builder()
* .name("workstation-config")
* .sourceDisk(mySourceDisk.name())
* .zone("us-central1-a")
* .build());
* var defaultWorkstationCluster = new WorkstationCluster("defaultWorkstationCluster", WorkstationClusterArgs.builder()
* .workstationClusterId("workstation-cluster")
* .network(default_.id())
* .subnetwork(defaultSubnetwork.id())
* .location("us-central1")
* .build());
* var defaultWorkstationConfig = new WorkstationConfig("defaultWorkstationConfig", WorkstationConfigArgs.builder()
* .workstationConfigId("workstation-config")
* .workstationClusterId(defaultWorkstationCluster.workstationClusterId())
* .location(defaultWorkstationCluster.location())
* .persistentDirectories(WorkstationConfigPersistentDirectoryArgs.builder()
* .mountPath("/home")
* .gcePd(WorkstationConfigPersistentDirectoryGcePdArgs.builder()
* .sourceSnapshot(mySourceSnapshot.id())
* .reclaimPolicy("DELETE")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:Network
* properties:
* name: workstation-cluster
* autoCreateSubnetworks: false
* defaultSubnetwork:
* type: gcp:compute:Subnetwork
* name: default
* properties:
* name: workstation-cluster
* ipCidrRange: 10.0.0.0/24
* region: us-central1
* network: ${default.name}
* mySourceDisk:
* type: gcp:compute:Disk
* name: my_source_disk
* properties:
* name: workstation-config
* size: 10
* type: pd-ssd
* zone: us-central1-a
* mySourceSnapshot:
* type: gcp:compute:Snapshot
* name: my_source_snapshot
* properties:
* name: workstation-config
* sourceDisk: ${mySourceDisk.name}
* zone: us-central1-a
* defaultWorkstationCluster:
* type: gcp:workstations:WorkstationCluster
* name: default
* properties:
* workstationClusterId: workstation-cluster
* network: ${default.id}
* subnetwork: ${defaultSubnetwork.id}
* location: us-central1
* defaultWorkstationConfig:
* type: gcp:workstations:WorkstationConfig
* name: default
* properties:
* 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,
* },
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.compute.Network("default",
* name="workstation-cluster",
* auto_create_subnetworks=False)
* default_subnetwork = gcp.compute.Subnetwork("default",
* name="workstation-cluster",
* ip_cidr_range="10.0.0.0/24",
* region="us-central1",
* network=default.name)
* default_workstation_cluster = gcp.workstations.WorkstationCluster("default",
* workstation_cluster_id="workstation-cluster",
* network=default.id,
* subnetwork=default_subnetwork.id,
* location="us-central1",
* labels={
* "label": "key",
* },
* annotations={
* "label-one": "value-one",
* })
* default_workstation_config = gcp.workstations.WorkstationConfig("default",
* workstation_config_id="workstation-config",
* workstation_cluster_id=default_workstation_cluster.workstation_cluster_id,
* location="us-central1",
* host={
* "gce_instance": {
* "machine_type": "e2-standard-4",
* "boot_disk_size_gb": 35,
* "disable_public_ip_addresses": True,
* "shielded_instance_config": {
* "enable_secure_boot": True,
* "enable_vtpm": True,
* },
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.Compute.Network("default", new()
* {
* Name = "workstation-cluster",
* AutoCreateSubnetworks = false,
* });
* var defaultSubnetwork = new Gcp.Compute.Subnetwork("default", new()
* {
* Name = "workstation-cluster",
* IpCidrRange = "10.0.0.0/24",
* Region = "us-central1",
* Network = @default.Name,
* });
* var defaultWorkstationCluster = new Gcp.Workstations.WorkstationCluster("default", new()
* {
* WorkstationClusterId = "workstation-cluster",
* Network = @default.Id,
* Subnetwork = defaultSubnetwork.Id,
* Location = "us-central1",
* Labels =
* {
* { "label", "key" },
* },
* Annotations =
* {
* { "label-one", "value-one" },
* },
* });
* var defaultWorkstationConfig = new Gcp.Workstations.WorkstationConfig("default", new()
* {
* WorkstationConfigId = "workstation-config",
* WorkstationClusterId = defaultWorkstationCluster.WorkstationClusterId,
* Location = "us-central1",
* Host = new Gcp.Workstations.Inputs.WorkstationConfigHostArgs
* {
* GceInstance = new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceArgs
* {
* MachineType = "e2-standard-4",
* BootDiskSizeGb = 35,
* DisablePublicIpAddresses = true,
* ShieldedInstanceConfig = new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceShieldedInstanceConfigArgs
* {
* EnableSecureBoot = true,
* EnableVtpm = true,
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workstations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* defaultSubnetwork, err := compute.NewSubnetwork(ctx, "default", &compute.SubnetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* IpCidrRange: pulumi.String("10.0.0.0/24"),
* Region: pulumi.String("us-central1"),
* Network: _default.Name,
* })
* if err != nil {
* return err
* }
* defaultWorkstationCluster, err := workstations.NewWorkstationCluster(ctx, "default", &workstations.WorkstationClusterArgs{
* WorkstationClusterId: pulumi.String("workstation-cluster"),
* Network: _default.ID(),
* Subnetwork: defaultSubnetwork.ID(),
* Location: pulumi.String("us-central1"),
* Labels: pulumi.StringMap{
* "label": pulumi.String("key"),
* },
* Annotations: pulumi.StringMap{
* "label-one": pulumi.String("value-one"),
* },
* })
* if err != nil {
* return err
* }
* _, err = workstations.NewWorkstationConfig(ctx, "default", &workstations.WorkstationConfigArgs{
* WorkstationConfigId: pulumi.String("workstation-config"),
* WorkstationClusterId: defaultWorkstationCluster.WorkstationClusterId,
* Location: pulumi.String("us-central1"),
* Host: &workstations.WorkstationConfigHostArgs{
* GceInstance: &workstations.WorkstationConfigHostGceInstanceArgs{
* MachineType: pulumi.String("e2-standard-4"),
* BootDiskSizeGb: pulumi.Int(35),
* DisablePublicIpAddresses: pulumi.Bool(true),
* ShieldedInstanceConfig: &workstations.WorkstationConfigHostGceInstanceShieldedInstanceConfigArgs{
* EnableSecureBoot: pulumi.Bool(true),
* EnableVtpm: pulumi.Bool(true),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.workstations.WorkstationCluster;
* import com.pulumi.gcp.workstations.WorkstationClusterArgs;
* import com.pulumi.gcp.workstations.WorkstationConfig;
* import com.pulumi.gcp.workstations.WorkstationConfigArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostGceInstanceArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostGceInstanceShieldedInstanceConfigArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var default_ = new Network("default", NetworkArgs.builder()
* .name("workstation-cluster")
* .autoCreateSubnetworks(false)
* .build());
* var defaultSubnetwork = new Subnetwork("defaultSubnetwork", SubnetworkArgs.builder()
* .name("workstation-cluster")
* .ipCidrRange("10.0.0.0/24")
* .region("us-central1")
* .network(default_.name())
* .build());
* var defaultWorkstationCluster = new WorkstationCluster("defaultWorkstationCluster", WorkstationClusterArgs.builder()
* .workstationClusterId("workstation-cluster")
* .network(default_.id())
* .subnetwork(defaultSubnetwork.id())
* .location("us-central1")
* .labels(Map.of("label", "key"))
* .annotations(Map.of("label-one", "value-one"))
* .build());
* var defaultWorkstationConfig = new WorkstationConfig("defaultWorkstationConfig", WorkstationConfigArgs.builder()
* .workstationConfigId("workstation-config")
* .workstationClusterId(defaultWorkstationCluster.workstationClusterId())
* .location("us-central1")
* .host(WorkstationConfigHostArgs.builder()
* .gceInstance(WorkstationConfigHostGceInstanceArgs.builder()
* .machineType("e2-standard-4")
* .bootDiskSizeGb(35)
* .disablePublicIpAddresses(true)
* .shieldedInstanceConfig(WorkstationConfigHostGceInstanceShieldedInstanceConfigArgs.builder()
* .enableSecureBoot(true)
* .enableVtpm(true)
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:Network
* properties:
* name: workstation-cluster
* autoCreateSubnetworks: false
* defaultSubnetwork:
* type: gcp:compute:Subnetwork
* name: default
* properties:
* name: workstation-cluster
* ipCidrRange: 10.0.0.0/24
* region: us-central1
* network: ${default.name}
* defaultWorkstationCluster:
* type: gcp:workstations:WorkstationCluster
* name: default
* properties:
* workstationClusterId: workstation-cluster
* network: ${default.id}
* subnetwork: ${defaultSubnetwork.id}
* location: us-central1
* labels:
* label: key
* annotations:
* label-one: value-one
* defaultWorkstationConfig:
* type: gcp:workstations:WorkstationConfig
* name: default
* properties:
* 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,
* }],
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.compute.Network("default",
* name="workstation-cluster",
* auto_create_subnetworks=False)
* default_subnetwork = gcp.compute.Subnetwork("default",
* name="workstation-cluster",
* ip_cidr_range="10.0.0.0/24",
* region="us-central1",
* network=default.name)
* default_workstation_cluster = gcp.workstations.WorkstationCluster("default",
* workstation_cluster_id="workstation-cluster",
* network=default.id,
* subnetwork=default_subnetwork.id,
* location="us-central1",
* labels={
* "label": "key",
* },
* annotations={
* "label-one": "value-one",
* })
* default_workstation_config = gcp.workstations.WorkstationConfig("default",
* workstation_config_id="workstation-config",
* workstation_cluster_id=default_workstation_cluster.workstation_cluster_id,
* location="us-central1",
* host={
* "gce_instance": {
* "machine_type": "n1-standard-2",
* "boot_disk_size_gb": 35,
* "disable_public_ip_addresses": True,
* "accelerators": [{
* "type": "nvidia-tesla-t4",
* "count": 1,
* }],
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.Compute.Network("default", new()
* {
* Name = "workstation-cluster",
* AutoCreateSubnetworks = false,
* });
* var defaultSubnetwork = new Gcp.Compute.Subnetwork("default", new()
* {
* Name = "workstation-cluster",
* IpCidrRange = "10.0.0.0/24",
* Region = "us-central1",
* Network = @default.Name,
* });
* var defaultWorkstationCluster = new Gcp.Workstations.WorkstationCluster("default", new()
* {
* WorkstationClusterId = "workstation-cluster",
* Network = @default.Id,
* Subnetwork = defaultSubnetwork.Id,
* Location = "us-central1",
* Labels =
* {
* { "label", "key" },
* },
* Annotations =
* {
* { "label-one", "value-one" },
* },
* });
* var defaultWorkstationConfig = new Gcp.Workstations.WorkstationConfig("default", new()
* {
* WorkstationConfigId = "workstation-config",
* WorkstationClusterId = defaultWorkstationCluster.WorkstationClusterId,
* Location = "us-central1",
* Host = new Gcp.Workstations.Inputs.WorkstationConfigHostArgs
* {
* GceInstance = new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceArgs
* {
* MachineType = "n1-standard-2",
* BootDiskSizeGb = 35,
* DisablePublicIpAddresses = true,
* Accelerators = new[]
* {
* new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceAcceleratorArgs
* {
* Type = "nvidia-tesla-t4",
* Count = 1,
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workstations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* defaultSubnetwork, err := compute.NewSubnetwork(ctx, "default", &compute.SubnetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* IpCidrRange: pulumi.String("10.0.0.0/24"),
* Region: pulumi.String("us-central1"),
* Network: _default.Name,
* })
* if err != nil {
* return err
* }
* defaultWorkstationCluster, err := workstations.NewWorkstationCluster(ctx, "default", &workstations.WorkstationClusterArgs{
* WorkstationClusterId: pulumi.String("workstation-cluster"),
* Network: _default.ID(),
* Subnetwork: defaultSubnetwork.ID(),
* Location: pulumi.String("us-central1"),
* Labels: pulumi.StringMap{
* "label": pulumi.String("key"),
* },
* Annotations: pulumi.StringMap{
* "label-one": pulumi.String("value-one"),
* },
* })
* if err != nil {
* return err
* }
* _, err = workstations.NewWorkstationConfig(ctx, "default", &workstations.WorkstationConfigArgs{
* WorkstationConfigId: pulumi.String("workstation-config"),
* WorkstationClusterId: defaultWorkstationCluster.WorkstationClusterId,
* Location: pulumi.String("us-central1"),
* Host: &workstations.WorkstationConfigHostArgs{
* GceInstance: &workstations.WorkstationConfigHostGceInstanceArgs{
* MachineType: pulumi.String("n1-standard-2"),
* BootDiskSizeGb: pulumi.Int(35),
* DisablePublicIpAddresses: pulumi.Bool(true),
* Accelerators: workstations.WorkstationConfigHostGceInstanceAcceleratorArray{
* &workstations.WorkstationConfigHostGceInstanceAcceleratorArgs{
* Type: pulumi.String("nvidia-tesla-t4"),
* Count: pulumi.Int(1),
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.workstations.WorkstationCluster;
* import com.pulumi.gcp.workstations.WorkstationClusterArgs;
* import com.pulumi.gcp.workstations.WorkstationConfig;
* import com.pulumi.gcp.workstations.WorkstationConfigArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostGceInstanceArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var default_ = new Network("default", NetworkArgs.builder()
* .name("workstation-cluster")
* .autoCreateSubnetworks(false)
* .build());
* var defaultSubnetwork = new Subnetwork("defaultSubnetwork", SubnetworkArgs.builder()
* .name("workstation-cluster")
* .ipCidrRange("10.0.0.0/24")
* .region("us-central1")
* .network(default_.name())
* .build());
* var defaultWorkstationCluster = new WorkstationCluster("defaultWorkstationCluster", WorkstationClusterArgs.builder()
* .workstationClusterId("workstation-cluster")
* .network(default_.id())
* .subnetwork(defaultSubnetwork.id())
* .location("us-central1")
* .labels(Map.of("label", "key"))
* .annotations(Map.of("label-one", "value-one"))
* .build());
* var defaultWorkstationConfig = new WorkstationConfig("defaultWorkstationConfig", WorkstationConfigArgs.builder()
* .workstationConfigId("workstation-config")
* .workstationClusterId(defaultWorkstationCluster.workstationClusterId())
* .location("us-central1")
* .host(WorkstationConfigHostArgs.builder()
* .gceInstance(WorkstationConfigHostGceInstanceArgs.builder()
* .machineType("n1-standard-2")
* .bootDiskSizeGb(35)
* .disablePublicIpAddresses(true)
* .accelerators(WorkstationConfigHostGceInstanceAcceleratorArgs.builder()
* .type("nvidia-tesla-t4")
* .count("1")
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:Network
* properties:
* name: workstation-cluster
* autoCreateSubnetworks: false
* defaultSubnetwork:
* type: gcp:compute:Subnetwork
* name: default
* properties:
* name: workstation-cluster
* ipCidrRange: 10.0.0.0/24
* region: us-central1
* network: ${default.name}
* defaultWorkstationCluster:
* type: gcp:workstations:WorkstationCluster
* name: default
* properties:
* workstationClusterId: workstation-cluster
* network: ${default.id}
* subnetwork: ${defaultSubnetwork.id}
* location: us-central1
* labels:
* label: key
* annotations:
* label-one: value-one
* defaultWorkstationConfig:
* type: gcp:workstations:WorkstationConfig
* name: default
* properties:
* 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,
* },
* ],
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.compute.Network("default",
* name="workstation-cluster",
* auto_create_subnetworks=False)
* default_subnetwork = gcp.compute.Subnetwork("default",
* name="workstation-cluster",
* ip_cidr_range="10.0.0.0/24",
* region="us-central1",
* network=default.name)
* default_workstation_cluster = gcp.workstations.WorkstationCluster("default",
* workstation_cluster_id="workstation-cluster",
* network=default.id,
* subnetwork=default_subnetwork.id,
* location="us-central1",
* labels={
* "label": "key",
* },
* annotations={
* "label-one": "value-one",
* })
* default_workstation_config = gcp.workstations.WorkstationConfig("default",
* workstation_config_id="workstation-config",
* workstation_cluster_id=default_workstation_cluster.workstation_cluster_id,
* location="us-central1",
* host={
* "gce_instance": {
* "machine_type": "e2-standard-4",
* "boot_disk_size_gb": 35,
* "disable_public_ip_addresses": True,
* "boost_configs": [
* {
* "id": "boost-1",
* "machine_type": "n1-standard-2",
* "accelerators": [{
* "type": "nvidia-tesla-t4",
* "count": 1,
* }],
* },
* {
* "id": "boost-2",
* "machine_type": "n1-standard-2",
* "pool_size": 2,
* "boot_disk_size_gb": 30,
* "enable_nested_virtualization": True,
* },
* ],
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.Compute.Network("default", new()
* {
* Name = "workstation-cluster",
* AutoCreateSubnetworks = false,
* });
* var defaultSubnetwork = new Gcp.Compute.Subnetwork("default", new()
* {
* Name = "workstation-cluster",
* IpCidrRange = "10.0.0.0/24",
* Region = "us-central1",
* Network = @default.Name,
* });
* var defaultWorkstationCluster = new Gcp.Workstations.WorkstationCluster("default", new()
* {
* WorkstationClusterId = "workstation-cluster",
* Network = @default.Id,
* Subnetwork = defaultSubnetwork.Id,
* Location = "us-central1",
* Labels =
* {
* { "label", "key" },
* },
* Annotations =
* {
* { "label-one", "value-one" },
* },
* });
* var defaultWorkstationConfig = new Gcp.Workstations.WorkstationConfig("default", new()
* {
* WorkstationConfigId = "workstation-config",
* WorkstationClusterId = defaultWorkstationCluster.WorkstationClusterId,
* Location = "us-central1",
* Host = new Gcp.Workstations.Inputs.WorkstationConfigHostArgs
* {
* GceInstance = new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceArgs
* {
* MachineType = "e2-standard-4",
* BootDiskSizeGb = 35,
* DisablePublicIpAddresses = true,
* BoostConfigs = new[]
* {
* new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceBoostConfigArgs
* {
* Id = "boost-1",
* MachineType = "n1-standard-2",
* Accelerators = new[]
* {
* new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceBoostConfigAcceleratorArgs
* {
* Type = "nvidia-tesla-t4",
* Count = 1,
* },
* },
* },
* new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceBoostConfigArgs
* {
* Id = "boost-2",
* MachineType = "n1-standard-2",
* PoolSize = 2,
* BootDiskSizeGb = 30,
* EnableNestedVirtualization = true,
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workstations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* defaultSubnetwork, err := compute.NewSubnetwork(ctx, "default", &compute.SubnetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* IpCidrRange: pulumi.String("10.0.0.0/24"),
* Region: pulumi.String("us-central1"),
* Network: _default.Name,
* })
* if err != nil {
* return err
* }
* defaultWorkstationCluster, err := workstations.NewWorkstationCluster(ctx, "default", &workstations.WorkstationClusterArgs{
* WorkstationClusterId: pulumi.String("workstation-cluster"),
* Network: _default.ID(),
* Subnetwork: defaultSubnetwork.ID(),
* Location: pulumi.String("us-central1"),
* Labels: pulumi.StringMap{
* "label": pulumi.String("key"),
* },
* Annotations: pulumi.StringMap{
* "label-one": pulumi.String("value-one"),
* },
* })
* if err != nil {
* return err
* }
* _, err = workstations.NewWorkstationConfig(ctx, "default", &workstations.WorkstationConfigArgs{
* WorkstationConfigId: pulumi.String("workstation-config"),
* WorkstationClusterId: defaultWorkstationCluster.WorkstationClusterId,
* Location: pulumi.String("us-central1"),
* Host: &workstations.WorkstationConfigHostArgs{
* GceInstance: &workstations.WorkstationConfigHostGceInstanceArgs{
* MachineType: pulumi.String("e2-standard-4"),
* BootDiskSizeGb: pulumi.Int(35),
* DisablePublicIpAddresses: pulumi.Bool(true),
* BoostConfigs: workstations.WorkstationConfigHostGceInstanceBoostConfigArray{
* &workstations.WorkstationConfigHostGceInstanceBoostConfigArgs{
* Id: pulumi.String("boost-1"),
* MachineType: pulumi.String("n1-standard-2"),
* Accelerators: workstations.WorkstationConfigHostGceInstanceBoostConfigAcceleratorArray{
* &workstations.WorkstationConfigHostGceInstanceBoostConfigAcceleratorArgs{
* Type: pulumi.String("nvidia-tesla-t4"),
* Count: pulumi.Int(1),
* },
* },
* },
* &workstations.WorkstationConfigHostGceInstanceBoostConfigArgs{
* Id: pulumi.String("boost-2"),
* MachineType: pulumi.String("n1-standard-2"),
* PoolSize: pulumi.Int(2),
* BootDiskSizeGb: pulumi.Int(30),
* EnableNestedVirtualization: pulumi.Bool(true),
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.workstations.WorkstationCluster;
* import com.pulumi.gcp.workstations.WorkstationClusterArgs;
* import com.pulumi.gcp.workstations.WorkstationConfig;
* import com.pulumi.gcp.workstations.WorkstationConfigArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostGceInstanceArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var default_ = new Network("default", NetworkArgs.builder()
* .name("workstation-cluster")
* .autoCreateSubnetworks(false)
* .build());
* var defaultSubnetwork = new Subnetwork("defaultSubnetwork", SubnetworkArgs.builder()
* .name("workstation-cluster")
* .ipCidrRange("10.0.0.0/24")
* .region("us-central1")
* .network(default_.name())
* .build());
* var defaultWorkstationCluster = new WorkstationCluster("defaultWorkstationCluster", WorkstationClusterArgs.builder()
* .workstationClusterId("workstation-cluster")
* .network(default_.id())
* .subnetwork(defaultSubnetwork.id())
* .location("us-central1")
* .labels(Map.of("label", "key"))
* .annotations(Map.of("label-one", "value-one"))
* .build());
* var defaultWorkstationConfig = new WorkstationConfig("defaultWorkstationConfig", WorkstationConfigArgs.builder()
* .workstationConfigId("workstation-config")
* .workstationClusterId(defaultWorkstationCluster.workstationClusterId())
* .location("us-central1")
* .host(WorkstationConfigHostArgs.builder()
* .gceInstance(WorkstationConfigHostGceInstanceArgs.builder()
* .machineType("e2-standard-4")
* .bootDiskSizeGb(35)
* .disablePublicIpAddresses(true)
* .boostConfigs(
* WorkstationConfigHostGceInstanceBoostConfigArgs.builder()
* .id("boost-1")
* .machineType("n1-standard-2")
* .accelerators(WorkstationConfigHostGceInstanceBoostConfigAcceleratorArgs.builder()
* .type("nvidia-tesla-t4")
* .count("1")
* .build())
* .build(),
* WorkstationConfigHostGceInstanceBoostConfigArgs.builder()
* .id("boost-2")
* .machineType("n1-standard-2")
* .poolSize(2)
* .bootDiskSizeGb(30)
* .enableNestedVirtualization(true)
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:Network
* properties:
* name: workstation-cluster
* autoCreateSubnetworks: false
* defaultSubnetwork:
* type: gcp:compute:Subnetwork
* name: default
* properties:
* name: workstation-cluster
* ipCidrRange: 10.0.0.0/24
* region: us-central1
* network: ${default.name}
* defaultWorkstationCluster:
* type: gcp:workstations:WorkstationCluster
* name: default
* properties:
* workstationClusterId: workstation-cluster
* network: ${default.id}
* subnetwork: ${defaultSubnetwork.id}
* location: us-central1
* labels:
* label: key
* annotations:
* label-one: value-one
* defaultWorkstationConfig:
* type: gcp:workstations:WorkstationConfig
* name: default
* properties:
* 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,
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.compute.Network("default",
* name="workstation-cluster",
* auto_create_subnetworks=False)
* default_subnetwork = gcp.compute.Subnetwork("default",
* name="workstation-cluster",
* ip_cidr_range="10.0.0.0/24",
* region="us-central1",
* network=default.name)
* default_workstation_cluster = gcp.workstations.WorkstationCluster("default",
* workstation_cluster_id="workstation-cluster",
* network=default.id,
* subnetwork=default_subnetwork.id,
* location="us-central1",
* labels={
* "label": "key",
* },
* annotations={
* "label-one": "value-one",
* })
* default_key_ring = gcp.kms.KeyRing("default",
* name="workstation-cluster",
* location="us-central1")
* default_crypto_key = gcp.kms.CryptoKey("default",
* name="workstation-cluster",
* key_ring=default_key_ring.id)
* default_account = gcp.serviceaccount.Account("default",
* account_id="my-account",
* display_name="Service Account")
* default_workstation_config = gcp.workstations.WorkstationConfig("default",
* workstation_config_id="workstation-config",
* workstation_cluster_id=default_workstation_cluster.workstation_cluster_id,
* location="us-central1",
* host={
* "gce_instance": {
* "machine_type": "e2-standard-4",
* "boot_disk_size_gb": 35,
* "disable_public_ip_addresses": True,
* "shielded_instance_config": {
* "enable_secure_boot": True,
* "enable_vtpm": True,
* },
* },
* },
* encryption_key={
* "kms_key": default_crypto_key.id,
* "kms_key_service_account": default_account.email,
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.Compute.Network("default", new()
* {
* Name = "workstation-cluster",
* AutoCreateSubnetworks = false,
* });
* var defaultSubnetwork = new Gcp.Compute.Subnetwork("default", new()
* {
* Name = "workstation-cluster",
* IpCidrRange = "10.0.0.0/24",
* Region = "us-central1",
* Network = @default.Name,
* });
* var defaultWorkstationCluster = new Gcp.Workstations.WorkstationCluster("default", new()
* {
* WorkstationClusterId = "workstation-cluster",
* Network = @default.Id,
* Subnetwork = defaultSubnetwork.Id,
* Location = "us-central1",
* Labels =
* {
* { "label", "key" },
* },
* Annotations =
* {
* { "label-one", "value-one" },
* },
* });
* var defaultKeyRing = new Gcp.Kms.KeyRing("default", new()
* {
* Name = "workstation-cluster",
* Location = "us-central1",
* });
* var defaultCryptoKey = new Gcp.Kms.CryptoKey("default", new()
* {
* Name = "workstation-cluster",
* KeyRing = defaultKeyRing.Id,
* });
* var defaultAccount = new Gcp.ServiceAccount.Account("default", new()
* {
* AccountId = "my-account",
* DisplayName = "Service Account",
* });
* var defaultWorkstationConfig = new Gcp.Workstations.WorkstationConfig("default", new()
* {
* WorkstationConfigId = "workstation-config",
* WorkstationClusterId = defaultWorkstationCluster.WorkstationClusterId,
* Location = "us-central1",
* Host = new Gcp.Workstations.Inputs.WorkstationConfigHostArgs
* {
* GceInstance = new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceArgs
* {
* MachineType = "e2-standard-4",
* BootDiskSizeGb = 35,
* DisablePublicIpAddresses = true,
* ShieldedInstanceConfig = new Gcp.Workstations.Inputs.WorkstationConfigHostGceInstanceShieldedInstanceConfigArgs
* {
* EnableSecureBoot = true,
* EnableVtpm = true,
* },
* },
* },
* EncryptionKey = new Gcp.Workstations.Inputs.WorkstationConfigEncryptionKeyArgs
* {
* KmsKey = defaultCryptoKey.Id,
* KmsKeyServiceAccount = defaultAccount.Email,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/kms"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/serviceaccount"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workstations"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* AutoCreateSubnetworks: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* defaultSubnetwork, err := compute.NewSubnetwork(ctx, "default", &compute.SubnetworkArgs{
* Name: pulumi.String("workstation-cluster"),
* IpCidrRange: pulumi.String("10.0.0.0/24"),
* Region: pulumi.String("us-central1"),
* Network: _default.Name,
* })
* if err != nil {
* return err
* }
* defaultWorkstationCluster, err := workstations.NewWorkstationCluster(ctx, "default", &workstations.WorkstationClusterArgs{
* WorkstationClusterId: pulumi.String("workstation-cluster"),
* Network: _default.ID(),
* Subnetwork: defaultSubnetwork.ID(),
* Location: pulumi.String("us-central1"),
* Labels: pulumi.StringMap{
* "label": pulumi.String("key"),
* },
* Annotations: pulumi.StringMap{
* "label-one": pulumi.String("value-one"),
* },
* })
* if err != nil {
* return err
* }
* defaultKeyRing, err := kms.NewKeyRing(ctx, "default", &kms.KeyRingArgs{
* Name: pulumi.String("workstation-cluster"),
* Location: pulumi.String("us-central1"),
* })
* if err != nil {
* return err
* }
* defaultCryptoKey, err := kms.NewCryptoKey(ctx, "default", &kms.CryptoKeyArgs{
* Name: pulumi.String("workstation-cluster"),
* KeyRing: defaultKeyRing.ID(),
* })
* if err != nil {
* return err
* }
* defaultAccount, err := serviceaccount.NewAccount(ctx, "default", &serviceaccount.AccountArgs{
* AccountId: pulumi.String("my-account"),
* DisplayName: pulumi.String("Service Account"),
* })
* if err != nil {
* return err
* }
* _, err = workstations.NewWorkstationConfig(ctx, "default", &workstations.WorkstationConfigArgs{
* WorkstationConfigId: pulumi.String("workstation-config"),
* WorkstationClusterId: defaultWorkstationCluster.WorkstationClusterId,
* Location: pulumi.String("us-central1"),
* Host: &workstations.WorkstationConfigHostArgs{
* GceInstance: &workstations.WorkstationConfigHostGceInstanceArgs{
* MachineType: pulumi.String("e2-standard-4"),
* BootDiskSizeGb: pulumi.Int(35),
* DisablePublicIpAddresses: pulumi.Bool(true),
* ShieldedInstanceConfig: &workstations.WorkstationConfigHostGceInstanceShieldedInstanceConfigArgs{
* EnableSecureBoot: pulumi.Bool(true),
* EnableVtpm: pulumi.Bool(true),
* },
* },
* },
* EncryptionKey: &workstations.WorkstationConfigEncryptionKeyArgs{
* KmsKey: defaultCryptoKey.ID(),
* KmsKeyServiceAccount: defaultAccount.Email,
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.compute.Network;
* import com.pulumi.gcp.compute.NetworkArgs;
* import com.pulumi.gcp.compute.Subnetwork;
* import com.pulumi.gcp.compute.SubnetworkArgs;
* import com.pulumi.gcp.workstations.WorkstationCluster;
* import com.pulumi.gcp.workstations.WorkstationClusterArgs;
* import com.pulumi.gcp.kms.KeyRing;
* import com.pulumi.gcp.kms.KeyRingArgs;
* import com.pulumi.gcp.kms.CryptoKey;
* import com.pulumi.gcp.kms.CryptoKeyArgs;
* import com.pulumi.gcp.serviceaccount.Account;
* import com.pulumi.gcp.serviceaccount.AccountArgs;
* import com.pulumi.gcp.workstations.WorkstationConfig;
* import com.pulumi.gcp.workstations.WorkstationConfigArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostGceInstanceArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigHostGceInstanceShieldedInstanceConfigArgs;
* import com.pulumi.gcp.workstations.inputs.WorkstationConfigEncryptionKeyArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var default_ = new Network("default", NetworkArgs.builder()
* .name("workstation-cluster")
* .autoCreateSubnetworks(false)
* .build());
* var defaultSubnetwork = new Subnetwork("defaultSubnetwork", SubnetworkArgs.builder()
* .name("workstation-cluster")
* .ipCidrRange("10.0.0.0/24")
* .region("us-central1")
* .network(default_.name())
* .build());
* var defaultWorkstationCluster = new WorkstationCluster("defaultWorkstationCluster", WorkstationClusterArgs.builder()
* .workstationClusterId("workstation-cluster")
* .network(default_.id())
* .subnetwork(defaultSubnetwork.id())
* .location("us-central1")
* .labels(Map.of("label", "key"))
* .annotations(Map.of("label-one", "value-one"))
* .build());
* var defaultKeyRing = new KeyRing("defaultKeyRing", KeyRingArgs.builder()
* .name("workstation-cluster")
* .location("us-central1")
* .build());
* var defaultCryptoKey = new CryptoKey("defaultCryptoKey", CryptoKeyArgs.builder()
* .name("workstation-cluster")
* .keyRing(defaultKeyRing.id())
* .build());
* var defaultAccount = new Account("defaultAccount", AccountArgs.builder()
* .accountId("my-account")
* .displayName("Service Account")
* .build());
* var defaultWorkstationConfig = new WorkstationConfig("defaultWorkstationConfig", WorkstationConfigArgs.builder()
* .workstationConfigId("workstation-config")
* .workstationClusterId(defaultWorkstationCluster.workstationClusterId())
* .location("us-central1")
* .host(WorkstationConfigHostArgs.builder()
* .gceInstance(WorkstationConfigHostGceInstanceArgs.builder()
* .machineType("e2-standard-4")
* .bootDiskSizeGb(35)
* .disablePublicIpAddresses(true)
* .shieldedInstanceConfig(WorkstationConfigHostGceInstanceShieldedInstanceConfigArgs.builder()
* .enableSecureBoot(true)
* .enableVtpm(true)
* .build())
* .build())
* .build())
* .encryptionKey(WorkstationConfigEncryptionKeyArgs.builder()
* .kmsKey(defaultCryptoKey.id())
* .kmsKeyServiceAccount(defaultAccount.email())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:Network
* properties:
* name: workstation-cluster
* autoCreateSubnetworks: false
* defaultSubnetwork:
* type: gcp:compute:Subnetwork
* name: default
* properties:
* name: workstation-cluster
* ipCidrRange: 10.0.0.0/24
* region: us-central1
* network: ${default.name}
* defaultWorkstationCluster:
* type: gcp:workstations:WorkstationCluster
* name: default
* properties:
* workstationClusterId: workstation-cluster
* network: ${default.id}
* subnetwork: ${defaultSubnetwork.id}
* location: us-central1
* labels:
* label: key
* annotations:
* label-one: value-one
* defaultKeyRing:
* type: gcp:kms:KeyRing
* name: default
* properties:
* name: workstation-cluster
* location: us-central1
* defaultCryptoKey:
* type: gcp:kms:CryptoKey
* name: default
* properties:
* name: workstation-cluster
* keyRing: ${defaultKeyRing.id}
* defaultAccount:
* type: gcp:serviceaccount:Account
* name: default
* properties:
* accountId: my-account
* displayName: Service Account
* defaultWorkstationConfig:
* type: gcp:workstations:WorkstationConfig
* name: default
* properties:
* 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}
* ```
*
* ## 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}}
* ```
*/
public class WorkstationConfig internal constructor(
override val javaResource: com.pulumi.gcp.workstations.WorkstationConfig,
) : KotlinCustomResource(javaResource, WorkstationConfigMapper) {
/**
* Client-specified annotations. This is distinct from labels.
* **Note**: This field is non-authoritative, and will only manage the annotations present in your configuration.
* Please refer to the field `effective_annotations` for all of the annotations present on the resource.
*/
public val annotations: Output>?
get() = javaResource.annotations().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
}).orElse(null)
})
/**
* Status conditions describing the current resource state.
* Structure is documented below.
*/
public val conditions: Output>
get() = javaResource.conditions().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
workstationConfigConditionToKotlin(args0)
})
})
})
/**
* Container that will be run for each workstation using this configuration when that workstation is started.
* Structure is documented below.
*/
public val container: Output
get() = javaResource.container().applyValue({ args0 ->
args0.let({ args0 ->
workstationConfigContainerToKotlin(args0)
})
})
/**
* Time when this resource was created.
*/
public val createTime: Output
get() = javaResource.createTime().applyValue({ args0 -> args0 })
/**
* Whether this resource is in degraded mode, in which case it may require user action to restore full functionality. Details can be found in the conditions field.
*/
public val degraded: Output
get() = javaResource.degraded().applyValue({ args0 -> args0 })
/**
* Disables support for plain TCP connections in the workstation. By default the service supports TCP connections via a websocket relay. Setting this option to true disables that relay, which prevents the usage of services that require plain tcp connections, such as ssh. When enabled, all communication must occur over https or wss.
*/
public val disableTcpConnections: Output?
get() = javaResource.disableTcpConnections().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Human-readable name for this resource.
*/
public val displayName: Output?
get() = javaResource.displayName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
public val effectiveAnnotations: Output>
get() = javaResource.effectiveAnnotations().applyValue({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
})
/**
* All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
*/
public val effectiveLabels: Output>
get() = javaResource.effectiveLabels().applyValue({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
})
/**
* Whether to enable Linux `auditd` logging on the workstation. When enabled, a service account must also be specified that has `logging.buckets.write` permission on the project. Operating system audit logging is distinct from Cloud Audit Logs.
*/
public val enableAuditAgent: Output?
get() = javaResource.enableAuditAgent().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Encrypts resources of this workstation configuration using a customer-managed encryption key.
* If specified, the boot disk of the Compute Engine instance and the persistent disk are encrypted using this encryption key. If this field is not set, the disks are encrypted using a generated key. Customer-managed encryption keys do not protect disk metadata.
* If the customer-managed encryption key is rotated, when the workstation instance is stopped, the system attempts to recreate the persistent disk with the new version of the key. Be sure to keep older versions of the key until the persistent disk is recreated. Otherwise, data on the persistent disk will be lost.
* If the encryption key is revoked, the workstation session will automatically be stopped within 7 hours.
* Structure is documented below.
*/
public val encryptionKey: Output?
get() = javaResource.encryptionKey().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> workstationConfigEncryptionKeyToKotlin(args0) })
}).orElse(null)
})
/**
* Ephemeral directories which won't persist across workstation sessions.
* Structure is documented below.
*/
public val ephemeralDirectories: Output>
get() = javaResource.ephemeralDirectories().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> workstationConfigEphemeralDirectoryToKotlin(args0) })
})
})
/**
* Checksum computed by the server.
* May be sent on update and delete requests to ensure that the client has an up-to-date value before proceeding.
*/
public val etag: Output
get() = javaResource.etag().applyValue({ args0 -> args0 })
/**
* Runtime host for a workstation.
* Structure is documented below.
*/
public val host: Output
get() = javaResource.host().applyValue({ args0 ->
args0.let({ args0 ->
workstationConfigHostToKotlin(args0)
})
})
/**
* How long to wait before automatically stopping an instance that hasn't recently received any user traffic. A value of 0 indicates that this instance should never time out from idleness. Defaults to 20 minutes.
* A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
*/
public val idleTimeout: Output?
get() = javaResource.idleTimeout().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Client-specified labels that are applied to the resource and that are also propagated to the underlying Compute Engine resources.
* **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
* Please refer to the field `effective_labels` for all of the labels present on the resource.
*/
public val labels: Output>?
get() = javaResource.labels().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
}).orElse(null)
})
/**
* The location where the workstation cluster config should reside.
* - - -
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* Full name of this resource.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Directories to persist across workstation sessions.
* Structure is documented below.
*/
public val persistentDirectories: Output>
get() = javaResource.persistentDirectories().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> workstationConfigPersistentDirectoryToKotlin(args0) })
})
})
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* The combination of labels configured directly on the resource
* and default labels configured on the provider.
*/
public val pulumiLabels: Output>
get() = javaResource.pulumiLabels().applyValue({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
})
/**
* Readiness checks to be performed on a workstation.
* Structure is documented below.
*/
public val readinessChecks: Output>?
get() = javaResource.readinessChecks().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
workstationConfigReadinessCheckToKotlin(args0)
})
})
}).orElse(null)
})
/**
* Specifies the zones used to replicate the VM and disk resources within the region. If set, exactly two zones within the workstation cluster's region must be specified—for example, `['us-central1-a', 'us-central1-f']`.
* If this field is empty, two default zones within the region are used. Immutable after the workstation configuration is created.
*/
public val replicaZones: Output>
get() = javaResource.replicaZones().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* How long to wait before automatically stopping a workstation after it was started. A value of 0 indicates that workstations using this configuration should never time out from running duration. Must be greater than 0 and less than 24 hours if `encryption_key` is set. Defaults to 12 hours.
* A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
*/
public val runningTimeout: Output?
get() = javaResource.runningTimeout().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The system-generated UID of the resource.
*/
public val uid: Output
get() = javaResource.uid().applyValue({ args0 -> args0 })
/**
* The ID of the parent workstation cluster.
*/
public val workstationClusterId: Output
get() = javaResource.workstationClusterId().applyValue({ args0 -> args0 })
/**
* The ID to be assigned to the workstation cluster config.
*/
public val workstationConfigId: Output
get() = javaResource.workstationConfigId().applyValue({ args0 -> args0 })
}
public object WorkstationConfigMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.workstations.WorkstationConfig::class == javaResource::class
override fun map(javaResource: Resource): WorkstationConfig = WorkstationConfig(
javaResource as
com.pulumi.gcp.workstations.WorkstationConfig,
)
}
/**
* @see [WorkstationConfig].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [WorkstationConfig].
*/
public suspend fun workstationConfig(
name: String,
block: suspend WorkstationConfigResourceBuilder.() -> Unit,
): WorkstationConfig {
val builder = WorkstationConfigResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [WorkstationConfig].
* @param name The _unique_ name of the resulting resource.
*/
public fun workstationConfig(name: String): WorkstationConfig {
val builder = WorkstationConfigResourceBuilder()
builder.name(name)
return builder.build()
}