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

com.pulumi.gcp.tpu.kotlin.V2Vm.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.tpu.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmAcceleratorConfig
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmDataDisk
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmNetworkConfig
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmNetworkEndpoint
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmSchedulingConfig
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmServiceAccount
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmShieldedInstanceConfig
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmSymptom
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.tpu.kotlin.outputs.V2VmAcceleratorConfig.Companion.toKotlin as v2VmAcceleratorConfigToKotlin
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmDataDisk.Companion.toKotlin as v2VmDataDiskToKotlin
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmNetworkConfig.Companion.toKotlin as v2VmNetworkConfigToKotlin
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmNetworkEndpoint.Companion.toKotlin as v2VmNetworkEndpointToKotlin
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmSchedulingConfig.Companion.toKotlin as v2VmSchedulingConfigToKotlin
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmServiceAccount.Companion.toKotlin as v2VmServiceAccountToKotlin
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmShieldedInstanceConfig.Companion.toKotlin as v2VmShieldedInstanceConfigToKotlin
import com.pulumi.gcp.tpu.kotlin.outputs.V2VmSymptom.Companion.toKotlin as v2VmSymptomToKotlin

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

    public var args: V2VmArgs = V2VmArgs()

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

/**
 * ## Example Usage
 * ### Tpu V2 Vm Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const available = gcp.tpu.getV2RuntimeVersions({});
 * const tpu = new gcp.tpu.V2Vm("tpu", {
 *     name: "test-tpu",
 *     zone: "us-central1-c",
 *     runtimeVersion: "tpu-vm-tf-2.13.0",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * available = gcp.tpu.get_v2_runtime_versions()
 * tpu = gcp.tpu.V2Vm("tpu",
 *     name="test-tpu",
 *     zone="us-central1-c",
 *     runtime_version="tpu-vm-tf-2.13.0")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var available = Gcp.Tpu.GetV2RuntimeVersions.Invoke();
 *     var tpu = new Gcp.Tpu.V2Vm("tpu", new()
 *     {
 *         Name = "test-tpu",
 *         Zone = "us-central1-c",
 *         RuntimeVersion = "tpu-vm-tf-2.13.0",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/tpu"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := tpu.GetV2RuntimeVersions(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = tpu.NewV2Vm(ctx, "tpu", &tpu.V2VmArgs{
 * 			Name:           pulumi.String("test-tpu"),
 * 			Zone:           pulumi.String("us-central1-c"),
 * 			RuntimeVersion: pulumi.String("tpu-vm-tf-2.13.0"),
 * 		})
 * 		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.tpu.TpuFunctions;
 * import com.pulumi.gcp.tpu.inputs.GetV2RuntimeVersionsArgs;
 * import com.pulumi.gcp.tpu.V2Vm;
 * import com.pulumi.gcp.tpu.V2VmArgs;
 * 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 available = TpuFunctions.getV2RuntimeVersions();
 *         var tpu = new V2Vm("tpu", V2VmArgs.builder()
 *             .name("test-tpu")
 *             .zone("us-central1-c")
 *             .runtimeVersion("tpu-vm-tf-2.13.0")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   tpu:
 *     type: gcp:tpu:V2Vm
 *     properties:
 *       name: test-tpu
 *       zone: us-central1-c
 *       runtimeVersion: tpu-vm-tf-2.13.0
 * variables:
 *   available:
 *     fn::invoke:
 *       Function: gcp:tpu:getV2RuntimeVersions
 *       Arguments: {}
 * ```
 * 
 * ### Tpu V2 Vm Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as time from "@pulumi/time";
 * const available = gcp.tpu.getV2RuntimeVersions({});
 * const availableGetV2AcceleratorTypes = gcp.tpu.getV2AcceleratorTypes({});
 * const network = new gcp.compute.Network("network", {
 *     name: "tpu-net",
 *     autoCreateSubnetworks: false,
 * });
 * const subnet = new gcp.compute.Subnetwork("subnet", {
 *     name: "tpu-subnet",
 *     ipCidrRange: "10.0.0.0/16",
 *     region: "us-central1",
 *     network: network.id,
 * });
 * const sa = new gcp.serviceaccount.Account("sa", {
 *     accountId: "tpu-sa",
 *     displayName: "Test TPU VM",
 * });
 * const disk = new gcp.compute.Disk("disk", {
 *     name: "tpu-disk",
 *     image: "debian-cloud/debian-11",
 *     size: 10,
 *     type: "pd-ssd",
 *     zone: "us-central1-c",
 * });
 * // Wait after service account creation to limit eventual consistency errors.
 * const wait60Seconds = new time.index.Sleep("wait_60_seconds", {createDuration: "60s"}, {
 *     dependsOn: [sa],
 * });
 * const tpu = new gcp.tpu.V2Vm("tpu", {
 *     name: "test-tpu",
 *     zone: "us-central1-c",
 *     description: "Text description of the TPU.",
 *     runtimeVersion: "tpu-vm-tf-2.13.0",
 *     acceleratorConfig: {
 *         type: "V2",
 *         topology: "2x2",
 *     },
 *     cidrBlock: "10.0.0.0/29",
 *     networkConfig: {
 *         canIpForward: true,
 *         enableExternalIps: true,
 *         network: network.id,
 *         subnetwork: subnet.id,
 *     },
 *     schedulingConfig: {
 *         preemptible: true,
 *     },
 *     shieldedInstanceConfig: {
 *         enableSecureBoot: true,
 *     },
 *     serviceAccount: {
 *         email: sa.email,
 *         scopes: ["https://www.googleapis.com/auth/cloud-platform"],
 *     },
 *     dataDisks: [{
 *         sourceDisk: disk.id,
 *         mode: "READ_ONLY",
 *     }],
 *     labels: {
 *         foo: "bar",
 *     },
 *     metadata: {
 *         foo: "bar",
 *     },
 *     tags: ["foo"],
 * }, {
 *     dependsOn: [wait60Seconds],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * import pulumi_time as time
 * available = gcp.tpu.get_v2_runtime_versions()
 * available_get_v2_accelerator_types = gcp.tpu.get_v2_accelerator_types()
 * network = gcp.compute.Network("network",
 *     name="tpu-net",
 *     auto_create_subnetworks=False)
 * subnet = gcp.compute.Subnetwork("subnet",
 *     name="tpu-subnet",
 *     ip_cidr_range="10.0.0.0/16",
 *     region="us-central1",
 *     network=network.id)
 * sa = gcp.serviceaccount.Account("sa",
 *     account_id="tpu-sa",
 *     display_name="Test TPU VM")
 * disk = gcp.compute.Disk("disk",
 *     name="tpu-disk",
 *     image="debian-cloud/debian-11",
 *     size=10,
 *     type="pd-ssd",
 *     zone="us-central1-c")
 * # Wait after service account creation to limit eventual consistency errors.
 * wait60_seconds = time.index.Sleep("wait_60_seconds", create_duration=60s,
 * opts = pulumi.ResourceOptions(depends_on=[sa]))
 * tpu = gcp.tpu.V2Vm("tpu",
 *     name="test-tpu",
 *     zone="us-central1-c",
 *     description="Text description of the TPU.",
 *     runtime_version="tpu-vm-tf-2.13.0",
 *     accelerator_config={
 *         "type": "V2",
 *         "topology": "2x2",
 *     },
 *     cidr_block="10.0.0.0/29",
 *     network_config={
 *         "can_ip_forward": True,
 *         "enable_external_ips": True,
 *         "network": network.id,
 *         "subnetwork": subnet.id,
 *     },
 *     scheduling_config={
 *         "preemptible": True,
 *     },
 *     shielded_instance_config={
 *         "enable_secure_boot": True,
 *     },
 *     service_account={
 *         "email": sa.email,
 *         "scopes": ["https://www.googleapis.com/auth/cloud-platform"],
 *     },
 *     data_disks=[{
 *         "source_disk": disk.id,
 *         "mode": "READ_ONLY",
 *     }],
 *     labels={
 *         "foo": "bar",
 *     },
 *     metadata={
 *         "foo": "bar",
 *     },
 *     tags=["foo"],
 *     opts = pulumi.ResourceOptions(depends_on=[wait60_seconds]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * using Time = Pulumi.Time;
 * return await Deployment.RunAsync(() =>
 * {
 *     var available = Gcp.Tpu.GetV2RuntimeVersions.Invoke();
 *     var availableGetV2AcceleratorTypes = Gcp.Tpu.GetV2AcceleratorTypes.Invoke();
 *     var network = new Gcp.Compute.Network("network", new()
 *     {
 *         Name = "tpu-net",
 *         AutoCreateSubnetworks = false,
 *     });
 *     var subnet = new Gcp.Compute.Subnetwork("subnet", new()
 *     {
 *         Name = "tpu-subnet",
 *         IpCidrRange = "10.0.0.0/16",
 *         Region = "us-central1",
 *         Network = network.Id,
 *     });
 *     var sa = new Gcp.ServiceAccount.Account("sa", new()
 *     {
 *         AccountId = "tpu-sa",
 *         DisplayName = "Test TPU VM",
 *     });
 *     var disk = new Gcp.Compute.Disk("disk", new()
 *     {
 *         Name = "tpu-disk",
 *         Image = "debian-cloud/debian-11",
 *         Size = 10,
 *         Type = "pd-ssd",
 *         Zone = "us-central1-c",
 *     });
 *     // Wait after service account creation to limit eventual consistency errors.
 *     var wait60Seconds = new Time.Index.Sleep("wait_60_seconds", new()
 *     {
 *         CreateDuration = "60s",
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             sa,
 *         },
 *     });
 *     var tpu = new Gcp.Tpu.V2Vm("tpu", new()
 *     {
 *         Name = "test-tpu",
 *         Zone = "us-central1-c",
 *         Description = "Text description of the TPU.",
 *         RuntimeVersion = "tpu-vm-tf-2.13.0",
 *         AcceleratorConfig = new Gcp.Tpu.Inputs.V2VmAcceleratorConfigArgs
 *         {
 *             Type = "V2",
 *             Topology = "2x2",
 *         },
 *         CidrBlock = "10.0.0.0/29",
 *         NetworkConfig = new Gcp.Tpu.Inputs.V2VmNetworkConfigArgs
 *         {
 *             CanIpForward = true,
 *             EnableExternalIps = true,
 *             Network = network.Id,
 *             Subnetwork = subnet.Id,
 *         },
 *         SchedulingConfig = new Gcp.Tpu.Inputs.V2VmSchedulingConfigArgs
 *         {
 *             Preemptible = true,
 *         },
 *         ShieldedInstanceConfig = new Gcp.Tpu.Inputs.V2VmShieldedInstanceConfigArgs
 *         {
 *             EnableSecureBoot = true,
 *         },
 *         ServiceAccount = new Gcp.Tpu.Inputs.V2VmServiceAccountArgs
 *         {
 *             Email = sa.Email,
 *             Scopes = new[]
 *             {
 *                 "https://www.googleapis.com/auth/cloud-platform",
 *             },
 *         },
 *         DataDisks = new[]
 *         {
 *             new Gcp.Tpu.Inputs.V2VmDataDiskArgs
 *             {
 *                 SourceDisk = disk.Id,
 *                 Mode = "READ_ONLY",
 *             },
 *         },
 *         Labels =
 *         {
 *             { "foo", "bar" },
 *         },
 *         Metadata =
 *         {
 *             { "foo", "bar" },
 *         },
 *         Tags = new[]
 *         {
 *             "foo",
 *         },
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             wait60Seconds,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/serviceaccount"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/tpu"
 * 	"github.com/pulumi/pulumi-time/sdk/go/time"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := tpu.GetV2RuntimeVersions(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = tpu.GetV2AcceleratorTypes(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		network, err := compute.NewNetwork(ctx, "network", &compute.NetworkArgs{
 * 			Name:                  pulumi.String("tpu-net"),
 * 			AutoCreateSubnetworks: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		subnet, err := compute.NewSubnetwork(ctx, "subnet", &compute.SubnetworkArgs{
 * 			Name:        pulumi.String("tpu-subnet"),
 * 			IpCidrRange: pulumi.String("10.0.0.0/16"),
 * 			Region:      pulumi.String("us-central1"),
 * 			Network:     network.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		sa, err := serviceaccount.NewAccount(ctx, "sa", &serviceaccount.AccountArgs{
 * 			AccountId:   pulumi.String("tpu-sa"),
 * 			DisplayName: pulumi.String("Test TPU VM"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		disk, err := compute.NewDisk(ctx, "disk", &compute.DiskArgs{
 * 			Name:  pulumi.String("tpu-disk"),
 * 			Image: pulumi.String("debian-cloud/debian-11"),
 * 			Size:  pulumi.Int(10),
 * 			Type:  pulumi.String("pd-ssd"),
 * 			Zone:  pulumi.String("us-central1-c"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// Wait after service account creation to limit eventual consistency errors.
 * 		wait60Seconds, err := time.NewSleep(ctx, "wait_60_seconds", &time.SleepArgs{
 * 			CreateDuration: "60s",
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			sa,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = tpu.NewV2Vm(ctx, "tpu", &tpu.V2VmArgs{
 * 			Name:           pulumi.String("test-tpu"),
 * 			Zone:           pulumi.String("us-central1-c"),
 * 			Description:    pulumi.String("Text description of the TPU."),
 * 			RuntimeVersion: pulumi.String("tpu-vm-tf-2.13.0"),
 * 			AcceleratorConfig: &tpu.V2VmAcceleratorConfigArgs{
 * 				Type:     pulumi.String("V2"),
 * 				Topology: pulumi.String("2x2"),
 * 			},
 * 			CidrBlock: pulumi.String("10.0.0.0/29"),
 * 			NetworkConfig: &tpu.V2VmNetworkConfigArgs{
 * 				CanIpForward:      pulumi.Bool(true),
 * 				EnableExternalIps: pulumi.Bool(true),
 * 				Network:           network.ID(),
 * 				Subnetwork:        subnet.ID(),
 * 			},
 * 			SchedulingConfig: &tpu.V2VmSchedulingConfigArgs{
 * 				Preemptible: pulumi.Bool(true),
 * 			},
 * 			ShieldedInstanceConfig: &tpu.V2VmShieldedInstanceConfigArgs{
 * 				EnableSecureBoot: pulumi.Bool(true),
 * 			},
 * 			ServiceAccount: &tpu.V2VmServiceAccountArgs{
 * 				Email: sa.Email,
 * 				Scopes: pulumi.StringArray{
 * 					pulumi.String("https://www.googleapis.com/auth/cloud-platform"),
 * 				},
 * 			},
 * 			DataDisks: tpu.V2VmDataDiskArray{
 * 				&tpu.V2VmDataDiskArgs{
 * 					SourceDisk: disk.ID(),
 * 					Mode:       pulumi.String("READ_ONLY"),
 * 				},
 * 			},
 * 			Labels: pulumi.StringMap{
 * 				"foo": pulumi.String("bar"),
 * 			},
 * 			Metadata: pulumi.StringMap{
 * 				"foo": pulumi.String("bar"),
 * 			},
 * 			Tags: pulumi.StringArray{
 * 				pulumi.String("foo"),
 * 			},
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			wait60Seconds,
 * 		}))
 * 		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.tpu.TpuFunctions;
 * import com.pulumi.gcp.tpu.inputs.GetV2RuntimeVersionsArgs;
 * import com.pulumi.gcp.tpu.inputs.GetV2AcceleratorTypesArgs;
 * 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.serviceaccount.Account;
 * import com.pulumi.gcp.serviceaccount.AccountArgs;
 * import com.pulumi.gcp.compute.Disk;
 * import com.pulumi.gcp.compute.DiskArgs;
 * import com.pulumi.time.sleep;
 * import com.pulumi.time.SleepArgs;
 * import com.pulumi.gcp.tpu.V2Vm;
 * import com.pulumi.gcp.tpu.V2VmArgs;
 * import com.pulumi.gcp.tpu.inputs.V2VmAcceleratorConfigArgs;
 * import com.pulumi.gcp.tpu.inputs.V2VmNetworkConfigArgs;
 * import com.pulumi.gcp.tpu.inputs.V2VmSchedulingConfigArgs;
 * import com.pulumi.gcp.tpu.inputs.V2VmShieldedInstanceConfigArgs;
 * import com.pulumi.gcp.tpu.inputs.V2VmServiceAccountArgs;
 * import com.pulumi.gcp.tpu.inputs.V2VmDataDiskArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 available = TpuFunctions.getV2RuntimeVersions();
 *         final var availableGetV2AcceleratorTypes = TpuFunctions.getV2AcceleratorTypes();
 *         var network = new Network("network", NetworkArgs.builder()
 *             .name("tpu-net")
 *             .autoCreateSubnetworks(false)
 *             .build());
 *         var subnet = new Subnetwork("subnet", SubnetworkArgs.builder()
 *             .name("tpu-subnet")
 *             .ipCidrRange("10.0.0.0/16")
 *             .region("us-central1")
 *             .network(network.id())
 *             .build());
 *         var sa = new Account("sa", AccountArgs.builder()
 *             .accountId("tpu-sa")
 *             .displayName("Test TPU VM")
 *             .build());
 *         var disk = new Disk("disk", DiskArgs.builder()
 *             .name("tpu-disk")
 *             .image("debian-cloud/debian-11")
 *             .size(10)
 *             .type("pd-ssd")
 *             .zone("us-central1-c")
 *             .build());
 *         // Wait after service account creation to limit eventual consistency errors.
 *         var wait60Seconds = new Sleep("wait60Seconds", SleepArgs.builder()
 *             .createDuration("60s")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(sa)
 *                 .build());
 *         var tpu = new V2Vm("tpu", V2VmArgs.builder()
 *             .name("test-tpu")
 *             .zone("us-central1-c")
 *             .description("Text description of the TPU.")
 *             .runtimeVersion("tpu-vm-tf-2.13.0")
 *             .acceleratorConfig(V2VmAcceleratorConfigArgs.builder()
 *                 .type("V2")
 *                 .topology("2x2")
 *                 .build())
 *             .cidrBlock("10.0.0.0/29")
 *             .networkConfig(V2VmNetworkConfigArgs.builder()
 *                 .canIpForward(true)
 *                 .enableExternalIps(true)
 *                 .network(network.id())
 *                 .subnetwork(subnet.id())
 *                 .build())
 *             .schedulingConfig(V2VmSchedulingConfigArgs.builder()
 *                 .preemptible(true)
 *                 .build())
 *             .shieldedInstanceConfig(V2VmShieldedInstanceConfigArgs.builder()
 *                 .enableSecureBoot(true)
 *                 .build())
 *             .serviceAccount(V2VmServiceAccountArgs.builder()
 *                 .email(sa.email())
 *                 .scopes("https://www.googleapis.com/auth/cloud-platform")
 *                 .build())
 *             .dataDisks(V2VmDataDiskArgs.builder()
 *                 .sourceDisk(disk.id())
 *                 .mode("READ_ONLY")
 *                 .build())
 *             .labels(Map.of("foo", "bar"))
 *             .metadata(Map.of("foo", "bar"))
 *             .tags("foo")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(wait60Seconds)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   tpu:
 *     type: gcp:tpu:V2Vm
 *     properties:
 *       name: test-tpu
 *       zone: us-central1-c
 *       description: Text description of the TPU.
 *       runtimeVersion: tpu-vm-tf-2.13.0
 *       acceleratorConfig:
 *         type: V2
 *         topology: 2x2
 *       cidrBlock: 10.0.0.0/29
 *       networkConfig:
 *         canIpForward: true
 *         enableExternalIps: true
 *         network: ${network.id}
 *         subnetwork: ${subnet.id}
 *       schedulingConfig:
 *         preemptible: true
 *       shieldedInstanceConfig:
 *         enableSecureBoot: true
 *       serviceAccount:
 *         email: ${sa.email}
 *         scopes:
 *           - https://www.googleapis.com/auth/cloud-platform
 *       dataDisks:
 *         - sourceDisk: ${disk.id}
 *           mode: READ_ONLY
 *       labels:
 *         foo: bar
 *       metadata:
 *         foo: bar
 *       tags:
 *         - foo
 *     options:
 *       dependson:
 *         - ${wait60Seconds}
 *   subnet:
 *     type: gcp:compute:Subnetwork
 *     properties:
 *       name: tpu-subnet
 *       ipCidrRange: 10.0.0.0/16
 *       region: us-central1
 *       network: ${network.id}
 *   network:
 *     type: gcp:compute:Network
 *     properties:
 *       name: tpu-net
 *       autoCreateSubnetworks: false
 *   sa:
 *     type: gcp:serviceaccount:Account
 *     properties:
 *       accountId: tpu-sa
 *       displayName: Test TPU VM
 *   disk:
 *     type: gcp:compute:Disk
 *     properties:
 *       name: tpu-disk
 *       image: debian-cloud/debian-11
 *       size: 10
 *       type: pd-ssd
 *       zone: us-central1-c
 *   # Wait after service account creation to limit eventual consistency errors.
 *   wait60Seconds:
 *     type: time:sleep
 *     name: wait_60_seconds
 *     properties:
 *       createDuration: 60s
 *     options:
 *       dependson:
 *         - ${sa}
 * variables:
 *   available:
 *     fn::invoke:
 *       Function: gcp:tpu:getV2RuntimeVersions
 *       Arguments: {}
 *   availableGetV2AcceleratorTypes:
 *     fn::invoke:
 *       Function: gcp:tpu:getV2AcceleratorTypes
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Vm can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{zone}}/nodes/{{name}}`
 * * `{{project}}/{{zone}}/{{name}}`
 * * `{{zone}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, Vm can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:tpu/v2Vm:V2Vm default projects/{{project}}/locations/{{zone}}/nodes/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:tpu/v2Vm:V2Vm default {{project}}/{{zone}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:tpu/v2Vm:V2Vm default {{zone}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:tpu/v2Vm:V2Vm default {{name}}
 * ```
 */
public class V2Vm internal constructor(
    override val javaResource: com.pulumi.gcp.tpu.V2Vm,
) : KotlinCustomResource(javaResource, V2VmMapper) {
    /**
     * The AccleratorConfig for the TPU Node. `accelerator_config` cannot be used at the same time
     * as `accelerator_type`. If neither is specified, `accelerator_type` defaults to 'v2-8'.
     * Structure is documented below.
     */
    public val acceleratorConfig: Output
        get() = javaResource.acceleratorConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                v2VmAcceleratorConfigToKotlin(args0)
            })
        })

    /**
     * TPU accelerator type for the TPU. `accelerator_type` cannot be used at the same time as
     * `accelerator_config`. If neither is specified, `accelerator_type` defaults to 'v2-8'.
     */
    public val acceleratorType: Output
        get() = javaResource.acceleratorType().applyValue({ args0 -> args0 })

    /**
     * The API version that created this Node.
     */
    public val apiVersion: Output
        get() = javaResource.apiVersion().applyValue({ args0 -> args0 })

    /**
     * The CIDR block that the TPU node will use when selecting an IP address. This CIDR block must
     * be a /29 block; the Compute Engine networks API forbids a smaller block, and using a larger
     * block would be wasteful (a node can only consume one IP address). Errors will occur if the
     * CIDR block has already been used for a currently existing TPU node, the CIDR block conflicts
     * with any subnetworks in the user's provided network, or the provided network is peered with
     * another network that is using that CIDR block.
     */
    public val cidrBlock: Output
        get() = javaResource.cidrBlock().applyValue({ args0 -> args0 })

    /**
     * The additional data disks for the Node.
     * Structure is documented below.
     */
    public val dataDisks: Output>?
        get() = javaResource.dataDisks().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> v2VmDataDiskToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Text description of the TPU.
     */
    public val description: Output?
        get() = javaResource.description().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 health status of the TPU node.
     */
    public val health: Output
        get() = javaResource.health().applyValue({ args0 -> args0 })

    /**
     * If this field is populated, it contains a description of why the TPU Node is unhealthy.
     */
    public val healthDescription: Output
        get() = javaResource.healthDescription().applyValue({ args0 -> args0 })

    /**
     * Resource labels to represent user-provided metadata.
     * **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)
        })

    /**
     * Custom metadata to apply to the TPU Node. Can set startup-script and shutdown-script.
     */
    public val metadata: Output>?
        get() = javaResource.metadata().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Whether the Node belongs to a Multislice group.
     */
    public val multisliceNode: Output
        get() = javaResource.multisliceNode().applyValue({ args0 -> args0 })

    /**
     * The immutable name of the TPU.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Network configurations for the TPU node.
     * Structure is documented below.
     */
    public val networkConfig: Output
        get() = javaResource.networkConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                v2VmNetworkConfigToKotlin(args0)
            })
        })

    /**
     * The network endpoints where TPU workers can be accessed and sent work. It is recommended that
     * runtime clients of the node reach out to the 0th entry in this map first.
     * Structure is documented below.
     */
    public val networkEndpoints: Output>
        get() = javaResource.networkEndpoints().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> v2VmNetworkEndpointToKotlin(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()
        })

    /**
     * The qualified name of the QueuedResource that requested this Node.
     */
    public val queuedResource: Output
        get() = javaResource.queuedResource().applyValue({ args0 -> args0 })

    /**
     * Runtime version for the TPU.
     * - - -
     */
    public val runtimeVersion: Output
        get() = javaResource.runtimeVersion().applyValue({ args0 -> args0 })

    /**
     * The scheduling options for this node.
     * Structure is documented below.
     */
    public val schedulingConfig: Output?
        get() = javaResource.schedulingConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> v2VmSchedulingConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The Google Cloud Platform Service Account to be used by the TPU node VMs. If None is
     * specified, the default compute service account will be used.
     * Structure is documented below.
     */
    public val serviceAccount: Output
        get() = javaResource.serviceAccount().applyValue({ args0 ->
            args0.let({ args0 ->
                v2VmServiceAccountToKotlin(args0)
            })
        })

    /**
     * Shielded Instance options.
     * Structure is documented below.
     */
    public val shieldedInstanceConfig: Output?
        get() = javaResource.shieldedInstanceConfig().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> v2VmShieldedInstanceConfigToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The current state for the TPU Node.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * The Symptoms that have occurred to the TPU Node.
     * Structure is documented below.
     */
    public val symptoms: Output>
        get() = javaResource.symptoms().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    v2VmSymptomToKotlin(args0)
                })
            })
        })

    /**
     * Tags to apply to the TPU Node. Tags are used to identify valid sources or targets for network firewalls.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * The GCP location for the TPU. If it is not provided, the provider zone is used.
     */
    public val zone: Output
        get() = javaResource.zone().applyValue({ args0 -> args0 })
}

public object V2VmMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.tpu.V2Vm::class == javaResource::class

    override fun map(javaResource: Resource): V2Vm = V2Vm(javaResource as com.pulumi.gcp.tpu.V2Vm)
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy