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

com.pulumi.gcp.notebooks.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.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.notebooks.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.notebooks.kotlin.outputs.InstanceAcceleratorConfig
import com.pulumi.gcp.notebooks.kotlin.outputs.InstanceContainerImage
import com.pulumi.gcp.notebooks.kotlin.outputs.InstanceReservationAffinity
import com.pulumi.gcp.notebooks.kotlin.outputs.InstanceShieldedInstanceConfig
import com.pulumi.gcp.notebooks.kotlin.outputs.InstanceVmImage
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.notebooks.kotlin.outputs.InstanceAcceleratorConfig.Companion.toKotlin as instanceAcceleratorConfigToKotlin
import com.pulumi.gcp.notebooks.kotlin.outputs.InstanceContainerImage.Companion.toKotlin as instanceContainerImageToKotlin
import com.pulumi.gcp.notebooks.kotlin.outputs.InstanceReservationAffinity.Companion.toKotlin as instanceReservationAffinityToKotlin
import com.pulumi.gcp.notebooks.kotlin.outputs.InstanceShieldedInstanceConfig.Companion.toKotlin as instanceShieldedInstanceConfigToKotlin
import com.pulumi.gcp.notebooks.kotlin.outputs.InstanceVmImage.Companion.toKotlin as instanceVmImageToKotlin

/**
 * 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.notebooks.Instance(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Instance(builtJavaResource)
    }
}

/**
 * > **Warning:** `google_notebook_instance` is deprecated and will be removed in a future major release. Use `gcp.workbench.Instance` instead.
 * A Cloud AI Platform Notebook instance.
 * > **Note:** Due to limitations of the Notebooks Instance API, many fields
 * in this resource do not properly detect drift. These fields will also not
 * appear in state once imported.
 * To get more information about Instance, see:
 * * [API documentation](https://cloud.google.com/ai-platform/notebooks/docs/reference/rest)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/ai-platform-notebooks)
 * ## Example Usage
 * ### Notebook Instance Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const instance = new gcp.notebooks.Instance("instance", {
 *     name: "notebooks-instance",
 *     location: "us-west1-a",
 *     machineType: "e2-medium",
 *     vmImage: {
 *         project: "deeplearning-platform-release",
 *         imageFamily: "tf-latest-cpu",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.notebooks.Instance("instance",
 *     name="notebooks-instance",
 *     location="us-west1-a",
 *     machine_type="e2-medium",
 *     vm_image=gcp.notebooks.InstanceVmImageArgs(
 *         project="deeplearning-platform-release",
 *         image_family="tf-latest-cpu",
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.Notebooks.Instance("instance", new()
 *     {
 *         Name = "notebooks-instance",
 *         Location = "us-west1-a",
 *         MachineType = "e2-medium",
 *         VmImage = new Gcp.Notebooks.Inputs.InstanceVmImageArgs
 *         {
 *             Project = "deeplearning-platform-release",
 *             ImageFamily = "tf-latest-cpu",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/notebooks"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := notebooks.NewInstance(ctx, "instance", ¬ebooks.InstanceArgs{
 * 			Name:        pulumi.String("notebooks-instance"),
 * 			Location:    pulumi.String("us-west1-a"),
 * 			MachineType: pulumi.String("e2-medium"),
 * 			VmImage: ¬ebooks.InstanceVmImageArgs{
 * 				Project:     pulumi.String("deeplearning-platform-release"),
 * 				ImageFamily: pulumi.String("tf-latest-cpu"),
 * 			},
 * 		})
 * 		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.notebooks.Instance;
 * import com.pulumi.gcp.notebooks.InstanceArgs;
 * import com.pulumi.gcp.notebooks.inputs.InstanceVmImageArgs;
 * 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("notebooks-instance")
 *             .location("us-west1-a")
 *             .machineType("e2-medium")
 *             .vmImage(InstanceVmImageArgs.builder()
 *                 .project("deeplearning-platform-release")
 *                 .imageFamily("tf-latest-cpu")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:notebooks:Instance
 *     properties:
 *       name: notebooks-instance
 *       location: us-west1-a
 *       machineType: e2-medium
 *       vmImage:
 *         project: deeplearning-platform-release
 *         imageFamily: tf-latest-cpu
 * ```
 * 
 * ### Notebook Instance Basic Stopped
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const instance = new gcp.notebooks.Instance("instance", {
 *     name: "notebooks-instance",
 *     location: "us-west1-a",
 *     machineType: "e2-medium",
 *     vmImage: {
 *         project: "deeplearning-platform-release",
 *         imageFamily: "tf-latest-cpu",
 *     },
 *     desiredState: "STOPPED",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.notebooks.Instance("instance",
 *     name="notebooks-instance",
 *     location="us-west1-a",
 *     machine_type="e2-medium",
 *     vm_image=gcp.notebooks.InstanceVmImageArgs(
 *         project="deeplearning-platform-release",
 *         image_family="tf-latest-cpu",
 *     ),
 *     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.Notebooks.Instance("instance", new()
 *     {
 *         Name = "notebooks-instance",
 *         Location = "us-west1-a",
 *         MachineType = "e2-medium",
 *         VmImage = new Gcp.Notebooks.Inputs.InstanceVmImageArgs
 *         {
 *             Project = "deeplearning-platform-release",
 *             ImageFamily = "tf-latest-cpu",
 *         },
 *         DesiredState = "STOPPED",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/notebooks"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := notebooks.NewInstance(ctx, "instance", ¬ebooks.InstanceArgs{
 * 			Name:        pulumi.String("notebooks-instance"),
 * 			Location:    pulumi.String("us-west1-a"),
 * 			MachineType: pulumi.String("e2-medium"),
 * 			VmImage: ¬ebooks.InstanceVmImageArgs{
 * 				Project:     pulumi.String("deeplearning-platform-release"),
 * 				ImageFamily: pulumi.String("tf-latest-cpu"),
 * 			},
 * 			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.notebooks.Instance;
 * import com.pulumi.gcp.notebooks.InstanceArgs;
 * import com.pulumi.gcp.notebooks.inputs.InstanceVmImageArgs;
 * 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("notebooks-instance")
 *             .location("us-west1-a")
 *             .machineType("e2-medium")
 *             .vmImage(InstanceVmImageArgs.builder()
 *                 .project("deeplearning-platform-release")
 *                 .imageFamily("tf-latest-cpu")
 *                 .build())
 *             .desiredState("STOPPED")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:notebooks:Instance
 *     properties:
 *       name: notebooks-instance
 *       location: us-west1-a
 *       machineType: e2-medium
 *       vmImage:
 *         project: deeplearning-platform-release
 *         imageFamily: tf-latest-cpu
 *       desiredState: STOPPED
 * ```
 * 
 * ### Notebook Instance Basic Container
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const instance = new gcp.notebooks.Instance("instance", {
 *     name: "notebooks-instance",
 *     location: "us-west1-a",
 *     machineType: "e2-medium",
 *     metadata: {
 *         "proxy-mode": "service_account",
 *     },
 *     containerImage: {
 *         repository: "gcr.io/deeplearning-platform-release/base-cpu",
 *         tag: "latest",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.notebooks.Instance("instance",
 *     name="notebooks-instance",
 *     location="us-west1-a",
 *     machine_type="e2-medium",
 *     metadata={
 *         "proxy-mode": "service_account",
 *     },
 *     container_image=gcp.notebooks.InstanceContainerImageArgs(
 *         repository="gcr.io/deeplearning-platform-release/base-cpu",
 *         tag="latest",
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.Notebooks.Instance("instance", new()
 *     {
 *         Name = "notebooks-instance",
 *         Location = "us-west1-a",
 *         MachineType = "e2-medium",
 *         Metadata =
 *         {
 *             { "proxy-mode", "service_account" },
 *         },
 *         ContainerImage = new Gcp.Notebooks.Inputs.InstanceContainerImageArgs
 *         {
 *             Repository = "gcr.io/deeplearning-platform-release/base-cpu",
 *             Tag = "latest",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/notebooks"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := notebooks.NewInstance(ctx, "instance", ¬ebooks.InstanceArgs{
 * 			Name:        pulumi.String("notebooks-instance"),
 * 			Location:    pulumi.String("us-west1-a"),
 * 			MachineType: pulumi.String("e2-medium"),
 * 			Metadata: pulumi.StringMap{
 * 				"proxy-mode": pulumi.String("service_account"),
 * 			},
 * 			ContainerImage: ¬ebooks.InstanceContainerImageArgs{
 * 				Repository: pulumi.String("gcr.io/deeplearning-platform-release/base-cpu"),
 * 				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.notebooks.Instance;
 * import com.pulumi.gcp.notebooks.InstanceArgs;
 * import com.pulumi.gcp.notebooks.inputs.InstanceContainerImageArgs;
 * 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("notebooks-instance")
 *             .location("us-west1-a")
 *             .machineType("e2-medium")
 *             .metadata(Map.of("proxy-mode", "service_account"))
 *             .containerImage(InstanceContainerImageArgs.builder()
 *                 .repository("gcr.io/deeplearning-platform-release/base-cpu")
 *                 .tag("latest")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:notebooks:Instance
 *     properties:
 *       name: notebooks-instance
 *       location: us-west1-a
 *       machineType: e2-medium
 *       metadata:
 *         proxy-mode: service_account
 *       containerImage:
 *         repository: gcr.io/deeplearning-platform-release/base-cpu
 *         tag: latest
 * ```
 * 
 * ### Notebook Instance Basic Gpu
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const instance = new gcp.notebooks.Instance("instance", {
 *     name: "notebooks-instance",
 *     location: "us-west1-a",
 *     machineType: "n1-standard-1",
 *     installGpuDriver: true,
 *     acceleratorConfig: {
 *         type: "NVIDIA_TESLA_T4",
 *         coreCount: 1,
 *     },
 *     vmImage: {
 *         project: "deeplearning-platform-release",
 *         imageFamily: "tf-latest-gpu",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.notebooks.Instance("instance",
 *     name="notebooks-instance",
 *     location="us-west1-a",
 *     machine_type="n1-standard-1",
 *     install_gpu_driver=True,
 *     accelerator_config=gcp.notebooks.InstanceAcceleratorConfigArgs(
 *         type="NVIDIA_TESLA_T4",
 *         core_count=1,
 *     ),
 *     vm_image=gcp.notebooks.InstanceVmImageArgs(
 *         project="deeplearning-platform-release",
 *         image_family="tf-latest-gpu",
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.Notebooks.Instance("instance", new()
 *     {
 *         Name = "notebooks-instance",
 *         Location = "us-west1-a",
 *         MachineType = "n1-standard-1",
 *         InstallGpuDriver = true,
 *         AcceleratorConfig = new Gcp.Notebooks.Inputs.InstanceAcceleratorConfigArgs
 *         {
 *             Type = "NVIDIA_TESLA_T4",
 *             CoreCount = 1,
 *         },
 *         VmImage = new Gcp.Notebooks.Inputs.InstanceVmImageArgs
 *         {
 *             Project = "deeplearning-platform-release",
 *             ImageFamily = "tf-latest-gpu",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/notebooks"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := notebooks.NewInstance(ctx, "instance", ¬ebooks.InstanceArgs{
 * 			Name:             pulumi.String("notebooks-instance"),
 * 			Location:         pulumi.String("us-west1-a"),
 * 			MachineType:      pulumi.String("n1-standard-1"),
 * 			InstallGpuDriver: pulumi.Bool(true),
 * 			AcceleratorConfig: ¬ebooks.InstanceAcceleratorConfigArgs{
 * 				Type:      pulumi.String("NVIDIA_TESLA_T4"),
 * 				CoreCount: pulumi.Int(1),
 * 			},
 * 			VmImage: ¬ebooks.InstanceVmImageArgs{
 * 				Project:     pulumi.String("deeplearning-platform-release"),
 * 				ImageFamily: pulumi.String("tf-latest-gpu"),
 * 			},
 * 		})
 * 		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.notebooks.Instance;
 * import com.pulumi.gcp.notebooks.InstanceArgs;
 * import com.pulumi.gcp.notebooks.inputs.InstanceAcceleratorConfigArgs;
 * import com.pulumi.gcp.notebooks.inputs.InstanceVmImageArgs;
 * 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("notebooks-instance")
 *             .location("us-west1-a")
 *             .machineType("n1-standard-1")
 *             .installGpuDriver(true)
 *             .acceleratorConfig(InstanceAcceleratorConfigArgs.builder()
 *                 .type("NVIDIA_TESLA_T4")
 *                 .coreCount(1)
 *                 .build())
 *             .vmImage(InstanceVmImageArgs.builder()
 *                 .project("deeplearning-platform-release")
 *                 .imageFamily("tf-latest-gpu")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:notebooks:Instance
 *     properties:
 *       name: notebooks-instance
 *       location: us-west1-a
 *       machineType: n1-standard-1
 *       installGpuDriver: true
 *       acceleratorConfig:
 *         type: NVIDIA_TESLA_T4
 *         coreCount: 1
 *       vmImage:
 *         project: deeplearning-platform-release
 *         imageFamily: tf-latest-gpu
 * ```
 * 
 * ### Notebook Instance Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const myNetwork = gcp.compute.getNetwork({
 *     name: "default",
 * });
 * const mySubnetwork = gcp.compute.getSubnetwork({
 *     name: "default",
 *     region: "us-central1",
 * });
 * const instance = new gcp.notebooks.Instance("instance", {
 *     name: "notebooks-instance",
 *     location: "us-central1-a",
 *     machineType: "e2-medium",
 *     vmImage: {
 *         project: "deeplearning-platform-release",
 *         imageFamily: "tf-latest-cpu",
 *     },
 *     instanceOwners: ["my@service-account.com"],
 *     serviceAccount: "[email protected]",
 *     installGpuDriver: true,
 *     bootDiskType: "PD_SSD",
 *     bootDiskSizeGb: 110,
 *     noPublicIp: true,
 *     noProxyAccess: true,
 *     network: myNetwork.then(myNetwork => myNetwork.id),
 *     subnet: mySubnetwork.then(mySubnetwork => mySubnetwork.id),
 *     labels: {
 *         k: "val",
 *     },
 *     metadata: {
 *         terraform: "true",
 *     },
 *     serviceAccountScopes: [
 *         "https://www.googleapis.com/auth/bigquery",
 *         "https://www.googleapis.com/auth/devstorage.read_write",
 *         "https://www.googleapis.com/auth/cloud-platform",
 *         "https://www.googleapis.com/auth/userinfo.email",
 *     ],
 *     tags: [
 *         "foo",
 *         "bar",
 *     ],
 *     diskEncryption: "CMEK",
 *     kmsKey: "my-crypto-key",
 *     desiredState: "ACTIVE",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * my_network = gcp.compute.get_network(name="default")
 * my_subnetwork = gcp.compute.get_subnetwork(name="default",
 *     region="us-central1")
 * instance = gcp.notebooks.Instance("instance",
 *     name="notebooks-instance",
 *     location="us-central1-a",
 *     machine_type="e2-medium",
 *     vm_image=gcp.notebooks.InstanceVmImageArgs(
 *         project="deeplearning-platform-release",
 *         image_family="tf-latest-cpu",
 *     ),
 *     instance_owners=["my@service-account.com"],
 *     service_account="[email protected]",
 *     install_gpu_driver=True,
 *     boot_disk_type="PD_SSD",
 *     boot_disk_size_gb=110,
 *     no_public_ip=True,
 *     no_proxy_access=True,
 *     network=my_network.id,
 *     subnet=my_subnetwork.id,
 *     labels={
 *         "k": "val",
 *     },
 *     metadata={
 *         "terraform": "true",
 *     },
 *     service_account_scopes=[
 *         "https://www.googleapis.com/auth/bigquery",
 *         "https://www.googleapis.com/auth/devstorage.read_write",
 *         "https://www.googleapis.com/auth/cloud-platform",
 *         "https://www.googleapis.com/auth/userinfo.email",
 *     ],
 *     tags=[
 *         "foo",
 *         "bar",
 *     ],
 *     disk_encryption="CMEK",
 *     kms_key="my-crypto-key",
 *     desired_state="ACTIVE")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var myNetwork = Gcp.Compute.GetNetwork.Invoke(new()
 *     {
 *         Name = "default",
 *     });
 *     var mySubnetwork = Gcp.Compute.GetSubnetwork.Invoke(new()
 *     {
 *         Name = "default",
 *         Region = "us-central1",
 *     });
 *     var instance = new Gcp.Notebooks.Instance("instance", new()
 *     {
 *         Name = "notebooks-instance",
 *         Location = "us-central1-a",
 *         MachineType = "e2-medium",
 *         VmImage = new Gcp.Notebooks.Inputs.InstanceVmImageArgs
 *         {
 *             Project = "deeplearning-platform-release",
 *             ImageFamily = "tf-latest-cpu",
 *         },
 *         InstanceOwners = new[]
 *         {
 *             "[email protected]",
 *         },
 *         ServiceAccount = "[email protected]",
 *         InstallGpuDriver = true,
 *         BootDiskType = "PD_SSD",
 *         BootDiskSizeGb = 110,
 *         NoPublicIp = true,
 *         NoProxyAccess = true,
 *         Network = myNetwork.Apply(getNetworkResult => getNetworkResult.Id),
 *         Subnet = mySubnetwork.Apply(getSubnetworkResult => getSubnetworkResult.Id),
 *         Labels =
 *         {
 *             { "k", "val" },
 *         },
 *         Metadata =
 *         {
 *             { "terraform", "true" },
 *         },
 *         ServiceAccountScopes = new[]
 *         {
 *             "https://www.googleapis.com/auth/bigquery",
 *             "https://www.googleapis.com/auth/devstorage.read_write",
 *             "https://www.googleapis.com/auth/cloud-platform",
 *             "https://www.googleapis.com/auth/userinfo.email",
 *         },
 *         Tags = new[]
 *         {
 *             "foo",
 *             "bar",
 *         },
 *         DiskEncryption = "CMEK",
 *         KmsKey = "my-crypto-key",
 *         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/notebooks"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		myNetwork, err := compute.LookupNetwork(ctx, &compute.LookupNetworkArgs{
 * 			Name: "default",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		mySubnetwork, err := compute.LookupSubnetwork(ctx, &compute.LookupSubnetworkArgs{
 * 			Name:   pulumi.StringRef("default"),
 * 			Region: pulumi.StringRef("us-central1"),
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = notebooks.NewInstance(ctx, "instance", ¬ebooks.InstanceArgs{
 * 			Name:        pulumi.String("notebooks-instance"),
 * 			Location:    pulumi.String("us-central1-a"),
 * 			MachineType: pulumi.String("e2-medium"),
 * 			VmImage: ¬ebooks.InstanceVmImageArgs{
 * 				Project:     pulumi.String("deeplearning-platform-release"),
 * 				ImageFamily: pulumi.String("tf-latest-cpu"),
 * 			},
 * 			InstanceOwners: pulumi.StringArray{
 * 				pulumi.String("[email protected]"),
 * 			},
 * 			ServiceAccount:   pulumi.String("[email protected]"),
 * 			InstallGpuDriver: pulumi.Bool(true),
 * 			BootDiskType:     pulumi.String("PD_SSD"),
 * 			BootDiskSizeGb:   pulumi.Int(110),
 * 			NoPublicIp:       pulumi.Bool(true),
 * 			NoProxyAccess:    pulumi.Bool(true),
 * 			Network:          pulumi.String(myNetwork.Id),
 * 			Subnet:           pulumi.String(mySubnetwork.Id),
 * 			Labels: pulumi.StringMap{
 * 				"k": pulumi.String("val"),
 * 			},
 * 			Metadata: pulumi.StringMap{
 * 				"terraform": pulumi.String("true"),
 * 			},
 * 			ServiceAccountScopes: pulumi.StringArray{
 * 				pulumi.String("https://www.googleapis.com/auth/bigquery"),
 * 				pulumi.String("https://www.googleapis.com/auth/devstorage.read_write"),
 * 				pulumi.String("https://www.googleapis.com/auth/cloud-platform"),
 * 				pulumi.String("https://www.googleapis.com/auth/userinfo.email"),
 * 			},
 * 			Tags: pulumi.StringArray{
 * 				pulumi.String("foo"),
 * 				pulumi.String("bar"),
 * 			},
 * 			DiskEncryption: pulumi.String("CMEK"),
 * 			KmsKey:         pulumi.String("my-crypto-key"),
 * 			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.ComputeFunctions;
 * import com.pulumi.gcp.compute.inputs.GetNetworkArgs;
 * import com.pulumi.gcp.compute.inputs.GetSubnetworkArgs;
 * import com.pulumi.gcp.notebooks.Instance;
 * import com.pulumi.gcp.notebooks.InstanceArgs;
 * import com.pulumi.gcp.notebooks.inputs.InstanceVmImageArgs;
 * 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) {
 *         final var myNetwork = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
 *             .name("default")
 *             .build());
 *         final var mySubnetwork = ComputeFunctions.getSubnetwork(GetSubnetworkArgs.builder()
 *             .name("default")
 *             .region("us-central1")
 *             .build());
 *         var instance = new Instance("instance", InstanceArgs.builder()
 *             .name("notebooks-instance")
 *             .location("us-central1-a")
 *             .machineType("e2-medium")
 *             .vmImage(InstanceVmImageArgs.builder()
 *                 .project("deeplearning-platform-release")
 *                 .imageFamily("tf-latest-cpu")
 *                 .build())
 *             .instanceOwners("[email protected]")
 *             .serviceAccount("[email protected]")
 *             .installGpuDriver(true)
 *             .bootDiskType("PD_SSD")
 *             .bootDiskSizeGb(110)
 *             .noPublicIp(true)
 *             .noProxyAccess(true)
 *             .network(myNetwork.applyValue(getNetworkResult -> getNetworkResult.id()))
 *             .subnet(mySubnetwork.applyValue(getSubnetworkResult -> getSubnetworkResult.id()))
 *             .labels(Map.of("k", "val"))
 *             .metadata(Map.of("terraform", "true"))
 *             .serviceAccountScopes(
 *                 "https://www.googleapis.com/auth/bigquery",
 *                 "https://www.googleapis.com/auth/devstorage.read_write",
 *                 "https://www.googleapis.com/auth/cloud-platform",
 *                 "https://www.googleapis.com/auth/userinfo.email")
 *             .tags(
 *                 "foo",
 *                 "bar")
 *             .diskEncryption("CMEK")
 *             .kmsKey("my-crypto-key")
 *             .desiredState("ACTIVE")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:notebooks:Instance
 *     properties:
 *       name: notebooks-instance
 *       location: us-central1-a
 *       machineType: e2-medium
 *       vmImage:
 *         project: deeplearning-platform-release
 *         imageFamily: tf-latest-cpu
 *       instanceOwners:
 *         - [email protected]
 *       serviceAccount: [email protected]
 *       installGpuDriver: true
 *       bootDiskType: PD_SSD
 *       bootDiskSizeGb: 110
 *       noPublicIp: true
 *       noProxyAccess: true
 *       network: ${myNetwork.id}
 *       subnet: ${mySubnetwork.id}
 *       labels:
 *         k: val
 *       metadata:
 *         terraform: 'true'
 *       serviceAccountScopes:
 *         - https://www.googleapis.com/auth/bigquery
 *         - https://www.googleapis.com/auth/devstorage.read_write
 *         - https://www.googleapis.com/auth/cloud-platform
 *         - https://www.googleapis.com/auth/userinfo.email
 *       tags:
 *         - foo
 *         - bar
 *       diskEncryption: CMEK
 *       kmsKey: my-crypto-key
 *       desiredState: ACTIVE
 * variables:
 *   myNetwork:
 *     fn::invoke:
 *       Function: gcp:compute:getNetwork
 *       Arguments:
 *         name: default
 *   mySubnetwork:
 *     fn::invoke:
 *       Function: gcp:compute:getSubnetwork
 *       Arguments:
 *         name: default
 *         region: us-central1
 * ```
 * 
 * ## 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:notebooks/instance:Instance default projects/{{project}}/locations/{{location}}/instances/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:notebooks/instance:Instance default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:notebooks/instance:Instance default {{location}}/{{name}}
 * ```
 */
public class Instance internal constructor(
    override val javaResource: com.pulumi.gcp.notebooks.Instance,
) : KotlinCustomResource(javaResource, InstanceMapper) {
    /**
     * The hardware accelerator used on this instance. If you use accelerators,
     * make sure that your configuration has enough vCPUs and memory to support the
     * machineType you have selected.
     * Structure is documented below.
     */
    public val acceleratorConfig: Output?
        get() = javaResource.acceleratorConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> instanceAcceleratorConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The size of the boot disk in GB attached to this instance,
     * up to a maximum of 64000 GB (64 TB). The minimum recommended value is 100 GB.
     * If not specified, this defaults to 100.
     */
    public val bootDiskSizeGb: Output?
        get() = javaResource.bootDiskSizeGb().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Possible disk types for notebook instances.
     * Possible values are: `DISK_TYPE_UNSPECIFIED`, `PD_STANDARD`, `PD_SSD`, `PD_BALANCED`, `PD_EXTREME`.
     */
    public val bootDiskType: Output?
        get() = javaResource.bootDiskType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Use a container image to start the notebook instance.
     * Structure is documented below.
     */
    public val containerImage: Output?
        get() = javaResource.containerImage().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> instanceContainerImageToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Instance creation time
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Specify a custom Cloud Storage path where the GPU driver is stored.
     * If not specified, we'll automatically choose from official GPU drivers.
     */
    public val customGpuDriverPath: Output?
        get() = javaResource.customGpuDriverPath().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The size of the data disk in GB attached to this instance,
     * up to a maximum of 64000 GB (64 TB).
     * You can choose the size of the data disk based on how big your notebooks and data are.
     * If not specified, this defaults to 100.
     */
    public val dataDiskSizeGb: Output?
        get() = javaResource.dataDiskSizeGb().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Possible disk types for notebook instances.
     * Possible values are: `DISK_TYPE_UNSPECIFIED`, `PD_STANDARD`, `PD_SSD`, `PD_BALANCED`, `PD_EXTREME`.
     */
    public val dataDiskType: Output?
        get() = javaResource.dataDiskType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Desired state of the Notebook 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)
        })

    /**
     * Disk encryption method used on the boot and data disks, defaults to GMEK.
     * Possible values are: `DISK_ENCRYPTION_UNSPECIFIED`, `GMEK`, `CMEK`.
     */
    public val diskEncryption: Output
        get() = javaResource.diskEncryption().applyValue({ args0 -> args0 })

    /**
     * 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 the end user authorizes Google Cloud to install GPU driver
     * on this instance. If this field is empty or set to false, the GPU driver
     * won't be installed. Only applicable to instances with GPUs.
     */
    public val installGpuDriver: Output?
        get() = javaResource.installGpuDriver().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The list of owners 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)
        })

    /**
     * The KMS key used to encrypt the disks, only applicable if diskEncryption is CMEK.
     * Format: projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}
     */
    public val kmsKey: Output?
        get() = javaResource.kmsKey().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Labels to apply to this instance. These can be later modified by the setLabels method.
     * An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
     * **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)
        })

    /**
     * A reference to the zone where the machine resides.
     * - - -
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * A reference to a machine type which defines VM kind.
     */
    public val machineType: Output
        get() = javaResource.machineType().applyValue({ args0 -> args0 })

    /**
     * Custom metadata to apply to this instance.
     * An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
     */
    public val metadata: Output>?
        get() = javaResource.metadata().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The name specified for the Notebook instance.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the VPC that this instance is in.
     * Format: projects/{project_id}/global/networks/{network_id}
     */
    public val network: Output
        get() = javaResource.network().applyValue({ args0 -> args0 })

    /**
     * The type of vNIC driver.
     * Possible values are: `UNSPECIFIED_NIC_TYPE`, `VIRTIO_NET`, `GVNIC`.
     */
    public val nicType: Output?
        get() = javaResource.nicType().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The notebook instance will not register with the proxy..
     */
    public val noProxyAccess: Output?
        get() = javaResource.noProxyAccess().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * No public IP will be assigned to this instance.
     */
    public val noPublicIp: Output?
        get() = javaResource.noPublicIp().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * If true, the data disk will not be auto deleted when deleting the instance.
     */
    public val noRemoveDataDisk: Output?
        get() = javaResource.noRemoveDataDisk().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Path to a Bash script that automatically runs after a
     * notebook instance fully boots up. The path must be a URL
     * or Cloud Storage path (gs://path-to-file/file-name).
     */
    public val postStartupScript: Output?
        get() = javaResource.postStartupScript().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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 proxy endpoint that is used to access the Jupyter notebook.
     * Only returned when the resource is in a `PROVISIONED` state. If
     * needed you can utilize `pulumi up -refresh-only` to await
     * the population of this value.
     */
    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()
        })

    /**
     * Reservation Affinity for consuming Zonal reservation.
     * Structure is documented below.
     */
    public val reservationAffinity: Output?
        get() = javaResource.reservationAffinity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> instanceReservationAffinityToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The service account on this instance, giving access to other
     * Google Cloud services. You can use any service account within
     * the same project, but you must have the service account user
     * permission to use the instance. If not specified,
     * the Compute Engine default service account is used.
     */
    public val serviceAccount: Output
        get() = javaResource.serviceAccount().applyValue({ args0 -> args0 })

    /**
     * Optional. The URIs of service account scopes to be included in Compute Engine instances.
     * If not specified, the following scopes are defined:
     * - https://www.googleapis.com/auth/cloud-platform
     * - https://www.googleapis.com/auth/userinfo.email
     */
    public val serviceAccountScopes: Output>
        get() = javaResource.serviceAccountScopes().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * A set of Shielded Instance options. Check [Images using supported Shielded VM features]
     * Not all combinations are valid
     * Structure is documented below.
     */
    public val shieldedInstanceConfig: Output
        get() = javaResource.shieldedInstanceConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                instanceShieldedInstanceConfigToKotlin(args0)
            })
        })

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

    /**
     * The name of the subnet that this instance is in.
     * Format: projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}
     */
    public val subnet: Output
        get() = javaResource.subnet().applyValue({ args0 -> args0 })

    /**
     * The Compute Engine tags to add to instance.
     */
    public val tags: Output>
        get() = javaResource.tags().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Instance update time.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })

    /**
     * Use a Compute Engine VM image to start the notebook instance.
     * Structure is documented below.
     */
    public val vmImage: Output?
        get() = javaResource.vmImage().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    instanceVmImageToKotlin(args0)
                })
            }).orElse(null)
        })
}

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

    override fun map(javaResource: Resource): Instance = Instance(
        javaResource as
            com.pulumi.gcp.notebooks.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 - 2024 Weber Informatics LLC | Privacy Policy