1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. tpu
  5. getV2AcceleratorTypes
Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi

gcp.tpu.getV2AcceleratorTypes

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi

    Get accelerator types 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.getV2AcceleratorTypes({});
    
    import pulumi
    import pulumi_gcp as gcp
    
    available = gcp.tpu.get_v2_accelerator_types()
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/tpu"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tpu.GetV2AcceleratorTypes(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.GetV2AcceleratorTypes.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.GetV2AcceleratorTypesArgs;
    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.getV2AcceleratorTypes();
    
        }
    }
    
    variables:
      available:
        fn::invoke:
          Function: gcp:tpu:getV2AcceleratorTypes
          Arguments: {}
    

    Configure Basic TPU VM With Available Type

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const available = gcp.tpu.getV2AcceleratorTypes({});
    const availableGetV2RuntimeVersions = gcp.tpu.getV2RuntimeVersions({});
    const tpu = new gcp.tpu.V2Vm("tpu", {
        name: "test-tpu",
        zone: "us-central1-b",
        runtimeVersion: availableGetV2RuntimeVersions.then(availableGetV2RuntimeVersions => availableGetV2RuntimeVersions.versions?.[0]),
        acceleratorType: available.then(available => available.types?.[0]),
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    available = gcp.tpu.get_v2_accelerator_types()
    available_get_v2_runtime_versions = gcp.tpu.get_v2_runtime_versions()
    tpu = gcp.tpu.V2Vm("tpu",
        name="test-tpu",
        zone="us-central1-b",
        runtime_version=available_get_v2_runtime_versions.versions[0],
        accelerator_type=available.types[0])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/tpu"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		available, err := tpu.GetV2AcceleratorTypes(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		availableGetV2RuntimeVersions, 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(availableGetV2RuntimeVersions.Versions[0]),
    			AcceleratorType: pulumi.String(available.Types[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.GetV2AcceleratorTypes.Invoke();
    
        var availableGetV2RuntimeVersions = Gcp.Tpu.GetV2RuntimeVersions.Invoke();
    
        var tpu = new Gcp.Tpu.V2Vm("tpu", new()
        {
            Name = "test-tpu",
            Zone = "us-central1-b",
            RuntimeVersion = availableGetV2RuntimeVersions.Apply(getV2RuntimeVersionsResult => getV2RuntimeVersionsResult.Versions[0]),
            AcceleratorType = available.Apply(getV2AcceleratorTypesResult => getV2AcceleratorTypesResult.Types[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.GetV2AcceleratorTypesArgs;
    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.getV2AcceleratorTypes();
    
            final var availableGetV2RuntimeVersions = TpuFunctions.getV2RuntimeVersions();
    
            var tpu = new V2Vm("tpu", V2VmArgs.builder()
                .name("test-tpu")
                .zone("us-central1-b")
                .runtimeVersion(availableGetV2RuntimeVersions.applyValue(getV2RuntimeVersionsResult -> getV2RuntimeVersionsResult.versions()[0]))
                .acceleratorType(available.applyValue(getV2AcceleratorTypesResult -> getV2AcceleratorTypesResult.types()[0]))
                .build());
    
        }
    }
    
    resources:
      tpu:
        type: gcp:tpu:V2Vm
        properties:
          name: test-tpu
          zone: us-central1-b
          runtimeVersion: ${availableGetV2RuntimeVersions.versions[0]}
          acceleratorType: ${available.types[0]}
    variables:
      available:
        fn::invoke:
          Function: gcp:tpu:getV2AcceleratorTypes
          Arguments: {}
      availableGetV2RuntimeVersions:
        fn::invoke:
          Function: gcp:tpu:getV2RuntimeVersions
          Arguments: {}
    

    Using getV2AcceleratorTypes

    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 getV2AcceleratorTypes(args: GetV2AcceleratorTypesArgs, opts?: InvokeOptions): Promise<GetV2AcceleratorTypesResult>
    function getV2AcceleratorTypesOutput(args: GetV2AcceleratorTypesOutputArgs, opts?: InvokeOptions): Output<GetV2AcceleratorTypesResult>
    def get_v2_accelerator_types(project: Optional[str] = None,
                                 zone: Optional[str] = None,
                                 opts: Optional[InvokeOptions] = None) -> GetV2AcceleratorTypesResult
    def get_v2_accelerator_types_output(project: Optional[pulumi.Input[str]] = None,
                                 zone: Optional[pulumi.Input[str]] = None,
                                 opts: Optional[InvokeOptions] = None) -> Output[GetV2AcceleratorTypesResult]
    func GetV2AcceleratorTypes(ctx *Context, args *GetV2AcceleratorTypesArgs, opts ...InvokeOption) (*GetV2AcceleratorTypesResult, error)
    func GetV2AcceleratorTypesOutput(ctx *Context, args *GetV2AcceleratorTypesOutputArgs, opts ...InvokeOption) GetV2AcceleratorTypesResultOutput

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

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

    The following arguments are supported:

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

    getV2AcceleratorTypes Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Project string
    Types List<string>
    The list of accelerator types available for the given project and zone.
    Zone string
    Id string
    The provider-assigned unique ID for this managed resource.
    Project string
    Types []string
    The list of accelerator types available for the given project and zone.
    Zone string
    id String
    The provider-assigned unique ID for this managed resource.
    project String
    types List<String>
    The list of accelerator types available for the given project and zone.
    zone String
    id string
    The provider-assigned unique ID for this managed resource.
    project string
    types string[]
    The list of accelerator types available for the given project and zone.
    zone string
    id str
    The provider-assigned unique ID for this managed resource.
    project str
    types Sequence[str]
    The list of accelerator types available for the given project and zone.
    zone str
    id String
    The provider-assigned unique ID for this managed resource.
    project String
    types List<String>
    The list of accelerator types 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 v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi