1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. tpu
  5. getV2RuntimeVersions
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

gcp.tpu.getV2RuntimeVersions

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Get runtime versions available for a project. For more information see the official documentation and API.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const available = gcp.tpu.getV2RuntimeVersions({});
    
    import pulumi
    import pulumi_gcp as gcp
    
    available = gcp.tpu.get_v2_runtime_versions()
    
    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
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var available = Gcp.Tpu.GetV2RuntimeVersions.Invoke();
    
    });
    
    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 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();
    
        }
    }
    
    variables:
      available:
        fn::invoke:
          Function: gcp:tpu:getV2RuntimeVersions
          Arguments: {}
    

    Configure Basic TPU VM With Available Version

    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-b",
        runtimeVersion: available.then(available => available.versions?.[0]),
    });
    
    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-b",
        runtime_version=available.versions[0])
    
    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 {
    		available, 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-b"),
    			RuntimeVersion: pulumi.String(available.Versions[0]),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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-b",
            RuntimeVersion = available.Apply(getV2RuntimeVersionsResult => getV2RuntimeVersionsResult.Versions[0]),
        });
    
    });
    
    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-b")
                .runtimeVersion(available.applyValue(getV2RuntimeVersionsResult -> getV2RuntimeVersionsResult.versions()[0]))
                .build());
    
        }
    }
    
    resources:
      tpu:
        type: gcp:tpu:V2Vm
        properties:
          name: test-tpu
          zone: us-central1-b
          runtimeVersion: ${available.versions[0]}
    variables:
      available:
        fn::invoke:
          Function: gcp:tpu:getV2RuntimeVersions
          Arguments: {}
    

    Using getV2RuntimeVersions

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getV2RuntimeVersions(args: GetV2RuntimeVersionsArgs, opts?: InvokeOptions): Promise<GetV2RuntimeVersionsResult>
    function getV2RuntimeVersionsOutput(args: GetV2RuntimeVersionsOutputArgs, opts?: InvokeOptions): Output<GetV2RuntimeVersionsResult>
    def get_v2_runtime_versions(project: Optional[str] = None,
                                zone: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetV2RuntimeVersionsResult
    def get_v2_runtime_versions_output(project: Optional[pulumi.Input[str]] = None,
                                zone: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetV2RuntimeVersionsResult]
    func GetV2RuntimeVersions(ctx *Context, args *GetV2RuntimeVersionsArgs, opts ...InvokeOption) (*GetV2RuntimeVersionsResult, error)
    func GetV2RuntimeVersionsOutput(ctx *Context, args *GetV2RuntimeVersionsOutputArgs, opts ...InvokeOption) GetV2RuntimeVersionsResultOutput

    > Note: This function is named GetV2RuntimeVersions in the Go SDK.

    public static class GetV2RuntimeVersions 
    {
        public static Task<GetV2RuntimeVersionsResult> InvokeAsync(GetV2RuntimeVersionsArgs args, InvokeOptions? opts = null)
        public static Output<GetV2RuntimeVersionsResult> Invoke(GetV2RuntimeVersionsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetV2RuntimeVersionsResult> getV2RuntimeVersions(GetV2RuntimeVersionsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:tpu/getV2RuntimeVersions:getV2RuntimeVersions
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Project string
    The project to list versions for. If it is not provided, the provider project is used.
    Zone string
    The zone to list versions for. If it is not provided, the provider zone is used.
    Project string
    The project to list versions for. If it is not provided, the provider project is used.
    Zone string
    The zone to list versions for. If it is not provided, the provider zone is used.
    project String
    The project to list versions for. If it is not provided, the provider project is used.
    zone String
    The zone to list versions for. If it is not provided, the provider zone is used.
    project string
    The project to list versions for. If it is not provided, the provider project is used.
    zone string
    The zone to list versions for. If it is not provided, the provider zone is used.
    project str
    The project to list versions for. If it is not provided, the provider project is used.
    zone str
    The zone to list versions for. If it is not provided, the provider zone is used.
    project String
    The project to list versions for. If it is not provided, the provider project is used.
    zone String
    The zone to list versions for. If it is not provided, the provider zone is used.

    getV2RuntimeVersions Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Project string
    Versions List<string>
    The list of runtime versions available for the given project and zone.
    Zone string
    Id string
    The provider-assigned unique ID for this managed resource.
    Project string
    Versions []string
    The list of runtime versions available for the given project and zone.
    Zone string
    id String
    The provider-assigned unique ID for this managed resource.
    project String
    versions List<String>
    The list of runtime versions available for the given project and zone.
    zone String
    id string
    The provider-assigned unique ID for this managed resource.
    project string
    versions string[]
    The list of runtime versions available for the given project and zone.
    zone string
    id str
    The provider-assigned unique ID for this managed resource.
    project str
    versions Sequence[str]
    The list of runtime versions available for the given project and zone.
    zone str
    id String
    The provider-assigned unique ID for this managed resource.
    project String
    versions List<String>
    The list of runtime versions available for the given project and zone.
    zone String

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi