All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.gcp.workbench.kotlin.Instance.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.12.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.workbench.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.workbench.kotlin.outputs.InstanceGceSetup
import com.pulumi.gcp.workbench.kotlin.outputs.InstanceHealthInfo
import com.pulumi.gcp.workbench.kotlin.outputs.InstanceUpgradeHistory
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.workbench.kotlin.outputs.InstanceGceSetup.Companion.toKotlin as instanceGceSetupToKotlin
import com.pulumi.gcp.workbench.kotlin.outputs.InstanceHealthInfo.Companion.toKotlin as instanceHealthInfoToKotlin
import com.pulumi.gcp.workbench.kotlin.outputs.InstanceUpgradeHistory.Companion.toKotlin as instanceUpgradeHistoryToKotlin

/**
 * Builder for [Instance].
 */
@PulumiTagMarker
public class InstanceResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: InstanceArgs = InstanceArgs()

    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 InstanceArgsBuilder.() -> Unit) {
        val builder = InstanceArgsBuilder()
        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(): Instance {
        val builtJavaResource = com.pulumi.gcp.workbench.Instance(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Instance(builtJavaResource)
    }
}

/**
 * A Workbench instance.
 * ## Example Usage
 * ### Workbench Instance Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const instance = new gcp.workbench.Instance("instance", {
 *     name: "workbench-instance",
 *     location: "us-west1-a",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.workbench.Instance("instance",
 *     name="workbench-instance",
 *     location="us-west1-a")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.Workbench.Instance("instance", new()
 *     {
 *         Name = "workbench-instance",
 *         Location = "us-west1-a",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workbench"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := workbench.NewInstance(ctx, "instance", &workbench.InstanceArgs{
 * 			Name:     pulumi.String("workbench-instance"),
 * 			Location: pulumi.String("us-west1-a"),
 * 		})
 * 		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.workbench.Instance;
 * import com.pulumi.gcp.workbench.InstanceArgs;
 * 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 instance = new Instance("instance", InstanceArgs.builder()
 *             .name("workbench-instance")
 *             .location("us-west1-a")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:workbench:Instance
 *     properties:
 *       name: workbench-instance
 *       location: us-west1-a
 * ```
 * 
 * ### Workbench Instance Basic Container
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const instance = new gcp.workbench.Instance("instance", {
 *     name: "workbench-instance",
 *     location: "us-west1-a",
 *     gceSetup: {
 *         containerImage: {
 *             repository: "us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cu113.py310",
 *             tag: "latest",
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.workbench.Instance("instance",
 *     name="workbench-instance",
 *     location="us-west1-a",
 *     gce_setup=gcp.workbench.InstanceGceSetupArgs(
 *         container_image=gcp.workbench.InstanceGceSetupContainerImageArgs(
 *             repository="us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cu113.py310",
 *             tag="latest",
 *         ),
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.Workbench.Instance("instance", new()
 *     {
 *         Name = "workbench-instance",
 *         Location = "us-west1-a",
 *         GceSetup = new Gcp.Workbench.Inputs.InstanceGceSetupArgs
 *         {
 *             ContainerImage = new Gcp.Workbench.Inputs.InstanceGceSetupContainerImageArgs
 *             {
 *                 Repository = "us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cu113.py310",
 *                 Tag = "latest",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workbench"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := workbench.NewInstance(ctx, "instance", &workbench.InstanceArgs{
 * 			Name:     pulumi.String("workbench-instance"),
 * 			Location: pulumi.String("us-west1-a"),
 * 			GceSetup: &workbench.InstanceGceSetupArgs{
 * 				ContainerImage: &workbench.InstanceGceSetupContainerImageArgs{
 * 					Repository: pulumi.String("us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cu113.py310"),
 * 					Tag:        pulumi.String("latest"),
 * 				},
 * 			},
 * 		})
 * 		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.workbench.Instance;
 * import com.pulumi.gcp.workbench.InstanceArgs;
 * import com.pulumi.gcp.workbench.inputs.InstanceGceSetupArgs;
 * import com.pulumi.gcp.workbench.inputs.InstanceGceSetupContainerImageArgs;
 * 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 instance = new Instance("instance", InstanceArgs.builder()
 *             .name("workbench-instance")
 *             .location("us-west1-a")
 *             .gceSetup(InstanceGceSetupArgs.builder()
 *                 .containerImage(InstanceGceSetupContainerImageArgs.builder()
 *                     .repository("us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cu113.py310")
 *                     .tag("latest")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:workbench:Instance
 *     properties:
 *       name: workbench-instance
 *       location: us-west1-a
 *       gceSetup:
 *         containerImage:
 *           repository: us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cu113.py310
 *           tag: latest
 * ```
 * 
 * ### Workbench Instance Basic Gpu
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const instance = new gcp.workbench.Instance("instance", {
 *     name: "workbench-instance",
 *     location: "us-central1-a",
 *     gceSetup: {
 *         machineType: "n1-standard-1",
 *         acceleratorConfigs: [{
 *             type: "NVIDIA_TESLA_T4",
 *             coreCount: "1",
 *         }],
 *         vmImage: {
 *             project: "cloud-notebooks-managed",
 *             family: "workbench-instances",
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.workbench.Instance("instance",
 *     name="workbench-instance",
 *     location="us-central1-a",
 *     gce_setup=gcp.workbench.InstanceGceSetupArgs(
 *         machine_type="n1-standard-1",
 *         accelerator_configs=[gcp.workbench.InstanceGceSetupAcceleratorConfigArgs(
 *             type="NVIDIA_TESLA_T4",
 *             core_count="1",
 *         )],
 *         vm_image=gcp.workbench.InstanceGceSetupVmImageArgs(
 *             project="cloud-notebooks-managed",
 *             family="workbench-instances",
 *         ),
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.Workbench.Instance("instance", new()
 *     {
 *         Name = "workbench-instance",
 *         Location = "us-central1-a",
 *         GceSetup = new Gcp.Workbench.Inputs.InstanceGceSetupArgs
 *         {
 *             MachineType = "n1-standard-1",
 *             AcceleratorConfigs = new[]
 *             {
 *                 new Gcp.Workbench.Inputs.InstanceGceSetupAcceleratorConfigArgs
 *                 {
 *                     Type = "NVIDIA_TESLA_T4",
 *                     CoreCount = "1",
 *                 },
 *             },
 *             VmImage = new Gcp.Workbench.Inputs.InstanceGceSetupVmImageArgs
 *             {
 *                 Project = "cloud-notebooks-managed",
 *                 Family = "workbench-instances",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workbench"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := workbench.NewInstance(ctx, "instance", &workbench.InstanceArgs{
 * 			Name:     pulumi.String("workbench-instance"),
 * 			Location: pulumi.String("us-central1-a"),
 * 			GceSetup: &workbench.InstanceGceSetupArgs{
 * 				MachineType: pulumi.String("n1-standard-1"),
 * 				AcceleratorConfigs: workbench.InstanceGceSetupAcceleratorConfigArray{
 * 					&workbench.InstanceGceSetupAcceleratorConfigArgs{
 * 						Type:      pulumi.String("NVIDIA_TESLA_T4"),
 * 						CoreCount: pulumi.String("1"),
 * 					},
 * 				},
 * 				VmImage: &workbench.InstanceGceSetupVmImageArgs{
 * 					Project: pulumi.String("cloud-notebooks-managed"),
 * 					Family:  pulumi.String("workbench-instances"),
 * 				},
 * 			},
 * 		})
 * 		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.workbench.Instance;
 * import com.pulumi.gcp.workbench.InstanceArgs;
 * import com.pulumi.gcp.workbench.inputs.InstanceGceSetupArgs;
 * import com.pulumi.gcp.workbench.inputs.InstanceGceSetupVmImageArgs;
 * 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 instance = new Instance("instance", InstanceArgs.builder()
 *             .name("workbench-instance")
 *             .location("us-central1-a")
 *             .gceSetup(InstanceGceSetupArgs.builder()
 *                 .machineType("n1-standard-1")
 *                 .acceleratorConfigs(InstanceGceSetupAcceleratorConfigArgs.builder()
 *                     .type("NVIDIA_TESLA_T4")
 *                     .coreCount(1)
 *                     .build())
 *                 .vmImage(InstanceGceSetupVmImageArgs.builder()
 *                     .project("cloud-notebooks-managed")
 *                     .family("workbench-instances")
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:workbench:Instance
 *     properties:
 *       name: workbench-instance
 *       location: us-central1-a
 *       gceSetup:
 *         machineType: n1-standard-1
 *         acceleratorConfigs:
 *           - type: NVIDIA_TESLA_T4
 *             coreCount: 1
 *         vmImage:
 *           project: cloud-notebooks-managed
 *           family: workbench-instances
 * ```
 * 
 * ### Workbench Instance Labels Stopped
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const instance = new gcp.workbench.Instance("instance", {
 *     name: "workbench-instance",
 *     location: "us-central1-a",
 *     gceSetup: {
 *         machineType: "e2-standard-4",
 *         shieldedInstanceConfig: {
 *             enableSecureBoot: false,
 *             enableVtpm: false,
 *             enableIntegrityMonitoring: false,
 *         },
 *         serviceAccounts: [{
 *             email: "[email protected]",
 *         }],
 *         metadata: {
 *             terraform: "true",
 *         },
 *     },
 *     instanceOwners: ["my@service-account.com"],
 *     labels: {
 *         k: "val",
 *     },
 *     desiredState: "STOPPED",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.workbench.Instance("instance",
 *     name="workbench-instance",
 *     location="us-central1-a",
 *     gce_setup=gcp.workbench.InstanceGceSetupArgs(
 *         machine_type="e2-standard-4",
 *         shielded_instance_config=gcp.workbench.InstanceGceSetupShieldedInstanceConfigArgs(
 *             enable_secure_boot=False,
 *             enable_vtpm=False,
 *             enable_integrity_monitoring=False,
 *         ),
 *         service_accounts=[gcp.workbench.InstanceGceSetupServiceAccountArgs(
 *             email="[email protected]",
 *         )],
 *         metadata={
 *             "terraform": "true",
 *         },
 *     ),
 *     instance_owners=["my@service-account.com"],
 *     labels={
 *         "k": "val",
 *     },
 *     desired_state="STOPPED")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.Workbench.Instance("instance", new()
 *     {
 *         Name = "workbench-instance",
 *         Location = "us-central1-a",
 *         GceSetup = new Gcp.Workbench.Inputs.InstanceGceSetupArgs
 *         {
 *             MachineType = "e2-standard-4",
 *             ShieldedInstanceConfig = new Gcp.Workbench.Inputs.InstanceGceSetupShieldedInstanceConfigArgs
 *             {
 *                 EnableSecureBoot = false,
 *                 EnableVtpm = false,
 *                 EnableIntegrityMonitoring = false,
 *             },
 *             ServiceAccounts = new[]
 *             {
 *                 new Gcp.Workbench.Inputs.InstanceGceSetupServiceAccountArgs
 *                 {
 *                     Email = "[email protected]",
 *                 },
 *             },
 *             Metadata =
 *             {
 *                 { "terraform", "true" },
 *             },
 *         },
 *         InstanceOwners = new[]
 *         {
 *             "[email protected]",
 *         },
 *         Labels =
 *         {
 *             { "k", "val" },
 *         },
 *         DesiredState = "STOPPED",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workbench"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := workbench.NewInstance(ctx, "instance", &workbench.InstanceArgs{
 * 			Name:     pulumi.String("workbench-instance"),
 * 			Location: pulumi.String("us-central1-a"),
 * 			GceSetup: &workbench.InstanceGceSetupArgs{
 * 				MachineType: pulumi.String("e2-standard-4"),
 * 				ShieldedInstanceConfig: &workbench.InstanceGceSetupShieldedInstanceConfigArgs{
 * 					EnableSecureBoot:          pulumi.Bool(false),
 * 					EnableVtpm:                pulumi.Bool(false),
 * 					EnableIntegrityMonitoring: pulumi.Bool(false),
 * 				},
 * 				ServiceAccounts: workbench.InstanceGceSetupServiceAccountArray{
 * 					&workbench.InstanceGceSetupServiceAccountArgs{
 * 						Email: pulumi.String("[email protected]"),
 * 					},
 * 				},
 * 				Metadata: pulumi.StringMap{
 * 					"terraform": pulumi.String("true"),
 * 				},
 * 			},
 * 			InstanceOwners: pulumi.StringArray{
 * 				pulumi.String("[email protected]"),
 * 			},
 * 			Labels: pulumi.StringMap{
 * 				"k": pulumi.String("val"),
 * 			},
 * 			DesiredState: pulumi.String("STOPPED"),
 * 		})
 * 		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.workbench.Instance;
 * import com.pulumi.gcp.workbench.InstanceArgs;
 * import com.pulumi.gcp.workbench.inputs.InstanceGceSetupArgs;
 * import com.pulumi.gcp.workbench.inputs.InstanceGceSetupShieldedInstanceConfigArgs;
 * 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 instance = new Instance("instance", InstanceArgs.builder()
 *             .name("workbench-instance")
 *             .location("us-central1-a")
 *             .gceSetup(InstanceGceSetupArgs.builder()
 *                 .machineType("e2-standard-4")
 *                 .shieldedInstanceConfig(InstanceGceSetupShieldedInstanceConfigArgs.builder()
 *                     .enableSecureBoot(false)
 *                     .enableVtpm(false)
 *                     .enableIntegrityMonitoring(false)
 *                     .build())
 *                 .serviceAccounts(InstanceGceSetupServiceAccountArgs.builder()
 *                     .email("[email protected]")
 *                     .build())
 *                 .metadata(Map.of("terraform", "true"))
 *                 .build())
 *             .instanceOwners("[email protected]")
 *             .labels(Map.of("k", "val"))
 *             .desiredState("STOPPED")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:workbench:Instance
 *     properties:
 *       name: workbench-instance
 *       location: us-central1-a
 *       gceSetup:
 *         machineType: e2-standard-4
 *         shieldedInstanceConfig:
 *           enableSecureBoot: false
 *           enableVtpm: false
 *           enableIntegrityMonitoring: false
 *         serviceAccounts:
 *           - email: [email protected]
 *         metadata:
 *           terraform: 'true'
 *       instanceOwners:
 *         - [email protected]
 *       labels:
 *         k: val
 *       desiredState: STOPPED
 * ```
 * 
 * ### Workbench Instance Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const myNetwork = new gcp.compute.Network("my_network", {
 *     name: "wbi-test-default",
 *     autoCreateSubnetworks: false,
 * });
 * const mySubnetwork = new gcp.compute.Subnetwork("my_subnetwork", {
 *     name: "wbi-test-default",
 *     network: myNetwork.id,
 *     region: "us-central1",
 *     ipCidrRange: "10.0.1.0/24",
 * });
 * const instance = new gcp.workbench.Instance("instance", {
 *     name: "workbench-instance",
 *     location: "us-central1-a",
 *     gceSetup: {
 *         machineType: "n1-standard-4",
 *         acceleratorConfigs: [{
 *             type: "NVIDIA_TESLA_T4",
 *             coreCount: "1",
 *         }],
 *         shieldedInstanceConfig: {
 *             enableSecureBoot: true,
 *             enableVtpm: true,
 *             enableIntegrityMonitoring: true,
 *         },
 *         disablePublicIp: false,
 *         serviceAccounts: [{
 *             email: "[email protected]",
 *         }],
 *         bootDisk: {
 *             diskSizeGb: "310",
 *             diskType: "PD_SSD",
 *             diskEncryption: "CMEK",
 *             kmsKey: "my-crypto-key",
 *         },
 *         dataDisks: {
 *             diskSizeGb: "330",
 *             diskType: "PD_SSD",
 *             diskEncryption: "CMEK",
 *             kmsKey: "my-crypto-key",
 *         },
 *         networkInterfaces: [{
 *             network: myNetwork.id,
 *             subnet: mySubnetwork.id,
 *             nicType: "GVNIC",
 *         }],
 *         metadata: {
 *             terraform: "true",
 *         },
 *         enableIpForwarding: true,
 *         tags: [
 *             "abc",
 *             "def",
 *         ],
 *     },
 *     disableProxyAccess: true,
 *     instanceOwners: ["my@service-account.com"],
 *     labels: {
 *         k: "val",
 *     },
 *     desiredState: "ACTIVE",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * my_network = gcp.compute.Network("my_network",
 *     name="wbi-test-default",
 *     auto_create_subnetworks=False)
 * my_subnetwork = gcp.compute.Subnetwork("my_subnetwork",
 *     name="wbi-test-default",
 *     network=my_network.id,
 *     region="us-central1",
 *     ip_cidr_range="10.0.1.0/24")
 * instance = gcp.workbench.Instance("instance",
 *     name="workbench-instance",
 *     location="us-central1-a",
 *     gce_setup=gcp.workbench.InstanceGceSetupArgs(
 *         machine_type="n1-standard-4",
 *         accelerator_configs=[gcp.workbench.InstanceGceSetupAcceleratorConfigArgs(
 *             type="NVIDIA_TESLA_T4",
 *             core_count="1",
 *         )],
 *         shielded_instance_config=gcp.workbench.InstanceGceSetupShieldedInstanceConfigArgs(
 *             enable_secure_boot=True,
 *             enable_vtpm=True,
 *             enable_integrity_monitoring=True,
 *         ),
 *         disable_public_ip=False,
 *         service_accounts=[gcp.workbench.InstanceGceSetupServiceAccountArgs(
 *             email="[email protected]",
 *         )],
 *         boot_disk=gcp.workbench.InstanceGceSetupBootDiskArgs(
 *             disk_size_gb="310",
 *             disk_type="PD_SSD",
 *             disk_encryption="CMEK",
 *             kms_key="my-crypto-key",
 *         ),
 *         data_disks=gcp.workbench.InstanceGceSetupDataDisksArgs(
 *             disk_size_gb="330",
 *             disk_type="PD_SSD",
 *             disk_encryption="CMEK",
 *             kms_key="my-crypto-key",
 *         ),
 *         network_interfaces=[gcp.workbench.InstanceGceSetupNetworkInterfaceArgs(
 *             network=my_network.id,
 *             subnet=my_subnetwork.id,
 *             nic_type="GVNIC",
 *         )],
 *         metadata={
 *             "terraform": "true",
 *         },
 *         enable_ip_forwarding=True,
 *         tags=[
 *             "abc",
 *             "def",
 *         ],
 *     ),
 *     disable_proxy_access=True,
 *     instance_owners=["my@service-account.com"],
 *     labels={
 *         "k": "val",
 *     },
 *     desired_state="ACTIVE")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var myNetwork = new Gcp.Compute.Network("my_network", new()
 *     {
 *         Name = "wbi-test-default",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var mySubnetwork = new Gcp.Compute.Subnetwork("my_subnetwork", new()
 *     {
 *         Name = "wbi-test-default",
 *         Network = myNetwork.Id,
 *         Region = "us-central1",
 *         IpCidrRange = "10.0.1.0/24",
 *     });
 *     var instance = new Gcp.Workbench.Instance("instance", new()
 *     {
 *         Name = "workbench-instance",
 *         Location = "us-central1-a",
 *         GceSetup = new Gcp.Workbench.Inputs.InstanceGceSetupArgs
 *         {
 *             MachineType = "n1-standard-4",
 *             AcceleratorConfigs = new[]
 *             {
 *                 new Gcp.Workbench.Inputs.InstanceGceSetupAcceleratorConfigArgs
 *                 {
 *                     Type = "NVIDIA_TESLA_T4",
 *                     CoreCount = "1",
 *                 },
 *             },
 *             ShieldedInstanceConfig = new Gcp.Workbench.Inputs.InstanceGceSetupShieldedInstanceConfigArgs
 *             {
 *                 EnableSecureBoot = true,
 *                 EnableVtpm = true,
 *                 EnableIntegrityMonitoring = true,
 *             },
 *             DisablePublicIp = false,
 *             ServiceAccounts = new[]
 *             {
 *                 new Gcp.Workbench.Inputs.InstanceGceSetupServiceAccountArgs
 *                 {
 *                     Email = "[email protected]",
 *                 },
 *             },
 *             BootDisk = new Gcp.Workbench.Inputs.InstanceGceSetupBootDiskArgs
 *             {
 *                 DiskSizeGb = "310",
 *                 DiskType = "PD_SSD",
 *                 DiskEncryption = "CMEK",
 *                 KmsKey = "my-crypto-key",
 *             },
 *             DataDisks = new Gcp.Workbench.Inputs.InstanceGceSetupDataDisksArgs
 *             {
 *                 DiskSizeGb = "330",
 *                 DiskType = "PD_SSD",
 *                 DiskEncryption = "CMEK",
 *                 KmsKey = "my-crypto-key",
 *             },
 *             NetworkInterfaces = new[]
 *             {
 *                 new Gcp.Workbench.Inputs.InstanceGceSetupNetworkInterfaceArgs
 *                 {
 *                     Network = myNetwork.Id,
 *                     Subnet = mySubnetwork.Id,
 *                     NicType = "GVNIC",
 *                 },
 *             },
 *             Metadata =
 *             {
 *                 { "terraform", "true" },
 *             },
 *             EnableIpForwarding = true,
 *             Tags = new[]
 *             {
 *                 "abc",
 *                 "def",
 *             },
 *         },
 *         DisableProxyAccess = true,
 *         InstanceOwners = new[]
 *         {
 *             "[email protected]",
 *         },
 *         Labels =
 *         {
 *             { "k", "val" },
 *         },
 *         DesiredState = "ACTIVE",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/workbench"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		myNetwork, err := compute.NewNetwork(ctx, "my_network", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("wbi-test-default"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		mySubnetwork, err := compute.NewSubnetwork(ctx, "my_subnetwork", &compute.SubnetworkArgs{
 * 			Name:        pulumi.String("wbi-test-default"),
 * 			Network:     myNetwork.ID(),
 * 			Region:      pulumi.String("us-central1"),
 * 			IpCidrRange: pulumi.String("10.0.1.0/24"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = workbench.NewInstance(ctx, "instance", &workbench.InstanceArgs{
 * 			Name:     pulumi.String("workbench-instance"),
 * 			Location: pulumi.String("us-central1-a"),
 * 			GceSetup: &workbench.InstanceGceSetupArgs{
 * 				MachineType: pulumi.String("n1-standard-4"),
 * 				AcceleratorConfigs: workbench.InstanceGceSetupAcceleratorConfigArray{
 * 					&workbench.InstanceGceSetupAcceleratorConfigArgs{
 * 						Type:      pulumi.String("NVIDIA_TESLA_T4"),
 * 						CoreCount: pulumi.String("1"),
 * 					},
 * 				},
 * 				ShieldedInstanceConfig: &workbench.InstanceGceSetupShieldedInstanceConfigArgs{
 * 					EnableSecureBoot:          pulumi.Bool(true),
 * 					EnableVtpm:                pulumi.Bool(true),
 * 					EnableIntegrityMonitoring: pulumi.Bool(true),
 * 				},
 * 				DisablePublicIp: pulumi.Bool(false),
 * 				ServiceAccounts: workbench.InstanceGceSetupServiceAccountArray{
 * 					&workbench.InstanceGceSetupServiceAccountArgs{
 * 						Email: pulumi.String("[email protected]"),
 * 					},
 * 				},
 * 				BootDisk: &workbench.InstanceGceSetupBootDiskArgs{
 * 					DiskSizeGb:     pulumi.String("310"),
 * 					DiskType:       pulumi.String("PD_SSD"),
 * 					DiskEncryption: pulumi.String("CMEK"),
 * 					KmsKey:         pulumi.String("my-crypto-key"),
 * 				},
 * 				DataDisks: &workbench.InstanceGceSetupDataDisksArgs{
 * 					DiskSizeGb:     pulumi.String("330"),
 * 					DiskType:       pulumi.String("PD_SSD"),
 * 					DiskEncryption: pulumi.String("CMEK"),
 * 					KmsKey:         pulumi.String("my-crypto-key"),
 * 				},
 * 				NetworkInterfaces: workbench.InstanceGceSetupNetworkInterfaceArray{
 * 					&workbench.InstanceGceSetupNetworkInterfaceArgs{
 * 						Network: myNetwork.ID(),
 * 						Subnet:  mySubnetwork.ID(),
 * 						NicType: pulumi.String("GVNIC"),
 * 					},
 * 				},
 * 				Metadata: pulumi.StringMap{
 * 					"terraform": pulumi.String("true"),
 * 				},
 * 				EnableIpForwarding: pulumi.Bool(true),
 * 				Tags: pulumi.StringArray{
 * 					pulumi.String("abc"),
 * 					pulumi.String("def"),
 * 				},
 * 			},
 * 			DisableProxyAccess: pulumi.Bool(true),
 * 			InstanceOwners: pulumi.StringArray{
 * 				pulumi.String("[email protected]"),
 * 			},
 * 			Labels: pulumi.StringMap{
 * 				"k": pulumi.String("val"),
 * 			},
 * 			DesiredState: pulumi.String("ACTIVE"),
 * 		})
 * 		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.workbench.Instance;
 * import com.pulumi.gcp.workbench.InstanceArgs;
 * import com.pulumi.gcp.workbench.inputs.InstanceGceSetupArgs;
 * import com.pulumi.gcp.workbench.inputs.InstanceGceSetupShieldedInstanceConfigArgs;
 * import com.pulumi.gcp.workbench.inputs.InstanceGceSetupBootDiskArgs;
 * import com.pulumi.gcp.workbench.inputs.InstanceGceSetupDataDisksArgs;
 * 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 myNetwork = new Network("myNetwork", NetworkArgs.builder()
 *             .name("wbi-test-default")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var mySubnetwork = new Subnetwork("mySubnetwork", SubnetworkArgs.builder()
 *             .name("wbi-test-default")
 *             .network(myNetwork.id())
 *             .region("us-central1")
 *             .ipCidrRange("10.0.1.0/24")
 *             .build());
 *         var instance = new Instance("instance", InstanceArgs.builder()
 *             .name("workbench-instance")
 *             .location("us-central1-a")
 *             .gceSetup(InstanceGceSetupArgs.builder()
 *                 .machineType("n1-standard-4")
 *                 .acceleratorConfigs(InstanceGceSetupAcceleratorConfigArgs.builder()
 *                     .type("NVIDIA_TESLA_T4")
 *                     .coreCount(1)
 *                     .build())
 *                 .shieldedInstanceConfig(InstanceGceSetupShieldedInstanceConfigArgs.builder()
 *                     .enableSecureBoot(true)
 *                     .enableVtpm(true)
 *                     .enableIntegrityMonitoring(true)
 *                     .build())
 *                 .disablePublicIp(false)
 *                 .serviceAccounts(InstanceGceSetupServiceAccountArgs.builder()
 *                     .email("[email protected]")
 *                     .build())
 *                 .bootDisk(InstanceGceSetupBootDiskArgs.builder()
 *                     .diskSizeGb(310)
 *                     .diskType("PD_SSD")
 *                     .diskEncryption("CMEK")
 *                     .kmsKey("my-crypto-key")
 *                     .build())
 *                 .dataDisks(InstanceGceSetupDataDisksArgs.builder()
 *                     .diskSizeGb(330)
 *                     .diskType("PD_SSD")
 *                     .diskEncryption("CMEK")
 *                     .kmsKey("my-crypto-key")
 *                     .build())
 *                 .networkInterfaces(InstanceGceSetupNetworkInterfaceArgs.builder()
 *                     .network(myNetwork.id())
 *                     .subnet(mySubnetwork.id())
 *                     .nicType("GVNIC")
 *                     .build())
 *                 .metadata(Map.of("terraform", "true"))
 *                 .enableIpForwarding(true)
 *                 .tags(
 *                     "abc",
 *                     "def")
 *                 .build())
 *             .disableProxyAccess("true")
 *             .instanceOwners("[email protected]")
 *             .labels(Map.of("k", "val"))
 *             .desiredState("ACTIVE")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   myNetwork:
 *     type: gcp:compute:Network
 *     name: my_network
 *     properties:
 *       name: wbi-test-default
 *       autoCreateSubnetworks: false
 *   mySubnetwork:
 *     type: gcp:compute:Subnetwork
 *     name: my_subnetwork
 *     properties:
 *       name: wbi-test-default
 *       network: ${myNetwork.id}
 *       region: us-central1
 *       ipCidrRange: 10.0.1.0/24
 *   instance:
 *     type: gcp:workbench:Instance
 *     properties:
 *       name: workbench-instance
 *       location: us-central1-a
 *       gceSetup:
 *         machineType: n1-standard-4
 *         acceleratorConfigs:
 *           - type: NVIDIA_TESLA_T4
 *             coreCount: 1
 *         shieldedInstanceConfig:
 *           enableSecureBoot: true
 *           enableVtpm: true
 *           enableIntegrityMonitoring: true
 *         disablePublicIp: false
 *         serviceAccounts:
 *           - email: [email protected]
 *         bootDisk:
 *           diskSizeGb: 310
 *           diskType: PD_SSD
 *           diskEncryption: CMEK
 *           kmsKey: my-crypto-key
 *         dataDisks:
 *           diskSizeGb: 330
 *           diskType: PD_SSD
 *           diskEncryption: CMEK
 *           kmsKey: my-crypto-key
 *         networkInterfaces:
 *           - network: ${myNetwork.id}
 *             subnet: ${mySubnetwork.id}
 *             nicType: GVNIC
 *         metadata:
 *           terraform: 'true'
 *         enableIpForwarding: true
 *         tags:
 *           - abc
 *           - def
 *       disableProxyAccess: 'true'
 *       instanceOwners:
 *         - [email protected]
 *       labels:
 *         k: val
 *       desiredState: ACTIVE
 * ```
 * 
 * ## Import
 * Instance can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/instances/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, Instance can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:workbench/instance:Instance default projects/{{project}}/locations/{{location}}/instances/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:workbench/instance:Instance default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:workbench/instance:Instance default {{location}}/{{name}}
 * ```
 */
public class Instance internal constructor(
    override val javaResource: com.pulumi.gcp.workbench.Instance,
) : KotlinCustomResource(javaResource, InstanceMapper) {
    /**
     * An RFC3339 timestamp in UTC time. This in the format of yyyy-MM-ddTHH:mm:ss.SSSZ.
     * The milliseconds portion (".SSS") is optional.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Output only. Email address of entity that sent original CreateInstance request.
     */
    public val creator: Output
        get() = javaResource.creator().applyValue({ args0 -> args0 })

    /**
     * Desired state of the Workbench Instance. Set this field to `ACTIVE` to start the Instance, and `STOPPED` to stop the Instance.
     */
    public val desiredState: Output?
        get() = javaResource.desiredState().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Optional. If true, the workbench instance will not register with the proxy.
     */
    public val disableProxyAccess: Output?
        get() = javaResource.disableProxyAccess().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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()
        })

    /**
     * The definition of how to configure a VM instance outside of Resources and Identity.
     * Structure is documented below.
     */
    public val gceSetup: Output
        get() = javaResource.gceSetup().applyValue({ args0 ->
            args0.let({ args0 ->
                instanceGceSetupToKotlin(args0)
            })
        })

    /**
     * 'Output only. Additional information about instance health. Example:
     * healthInfo": { "docker_proxy_agent_status": "1", "docker_status": "1", "jupyterlab_api_status":
     * "-1", "jupyterlab_status": "-1", "updated": "2020-10-18 09:40:03.573409" }'
     */
    public val healthInfos: Output>
        get() = javaResource.healthInfos().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    instanceHealthInfoToKotlin(args0)
                })
            })
        })

    /**
     * Output only. Instance health_state.
     */
    public val healthState: Output
        get() = javaResource.healthState().applyValue({ args0 -> args0 })

    /**
     * Required. User-defined unique ID of this instance.
     */
    public val instanceId: Output?
        get() = javaResource.instanceId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 'Optional. Input only. The owner of this instance after creation. Format:
     * `[email protected]` Currently supports one owner only. If not specified, all of
     * the service account users of your VM instance''s service account can use the instance.'
     */
    public val instanceOwners: Output>?
        get() = javaResource.instanceOwners().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * Optional. Labels to apply to this instance. These can be later modified
     * by the UpdateInstance method.
     * **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)
        })

    /**
     * Part of `parent`. See documentation of `projectsId`.
     * - - -
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The name of this workbench instance. Format: `projects/{project_id}/locations/{location}/instances/{instance_id}`
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> 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 })

    /**
     * Output only. The proxy endpoint that is used to access the Jupyter notebook.
     */
    public val proxyUri: Output
        get() = javaResource.proxyUri().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()
        })

    /**
     * (Output)
     * Output only. The state of this instance upgrade history entry.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * An RFC3339 timestamp in UTC time. This in the format of yyyy-MM-ddTHH:mm:ss.SSSZ.
     * The milliseconds portion (".SSS") is optional.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })

    /**
     * Output only. The upgrade history of this instance.
     * Structure is documented below.
     */
    public val upgradeHistories: Output>
        get() = javaResource.upgradeHistories().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> instanceUpgradeHistoryToKotlin(args0) })
            })
        })
}

public object InstanceMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.workbench.Instance::class == javaResource::class

    override fun map(javaResource: Resource): Instance = Instance(
        javaResource as
            com.pulumi.gcp.workbench.Instance,
    )
}

/**
 * @see [Instance].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Instance].
 */
public suspend fun instance(name: String, block: suspend InstanceResourceBuilder.() -> Unit): Instance {
    val builder = InstanceResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Instance].
 * @param name The _unique_ name of the resulting resource.
 */
public fun instance(name: String): Instance {
    val builder = InstanceResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy