1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. tpu
  5. getTensorflowVersions
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.tpu.getTensorflowVersions

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    Get TensorFlow 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.getTensorflowVersions({});
    
    import pulumi
    import pulumi_gcp as gcp
    
    available = gcp.tpu.get_tensorflow_versions()
    
    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.GetTensorflowVersions(ctx, &tpu.GetTensorflowVersionsArgs{}, 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.GetTensorflowVersions.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.GetTensorflowVersionsArgs;
    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.getTensorflowVersions();
    
        }
    }
    
    variables:
      available:
        fn::invoke:
          Function: gcp:tpu:getTensorflowVersions
          Arguments: {}
    

    Configure Basic TPU Node With Available Version

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const available = gcp.tpu.getTensorflowVersions({});
    const tpu = new gcp.tpu.Node("tpu", {
        name: "test-tpu",
        zone: "us-central1-b",
        acceleratorType: "v3-8",
        tensorflowVersion: available.then(available => available.versions?.[0]),
        cidrBlock: "10.2.0.0/29",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    available = gcp.tpu.get_tensorflow_versions()
    tpu = gcp.tpu.Node("tpu",
        name="test-tpu",
        zone="us-central1-b",
        accelerator_type="v3-8",
        tensorflow_version=available.versions[0],
        cidr_block="10.2.0.0/29")
    
    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.GetTensorflowVersions(ctx, &tpu.GetTensorflowVersionsArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = tpu.NewNode(ctx, "tpu", &tpu.NodeArgs{
    			Name:              pulumi.String("test-tpu"),
    			Zone:              pulumi.String("us-central1-b"),
    			AcceleratorType:   pulumi.String("v3-8"),
    			TensorflowVersion: pulumi.String(available.Versions[0]),
    			CidrBlock:         pulumi.String("10.2.0.0/29"),
    		})
    		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.GetTensorflowVersions.Invoke();
    
        var tpu = new Gcp.Tpu.Node("tpu", new()
        {
            Name = "test-tpu",
            Zone = "us-central1-b",
            AcceleratorType = "v3-8",
            TensorflowVersion = available.Apply(getTensorflowVersionsResult => getTensorflowVersionsResult.Versions[0]),
            CidrBlock = "10.2.0.0/29",
        });
    
    });
    
    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.GetTensorflowVersionsArgs;
    import com.pulumi.gcp.tpu.Node;
    import com.pulumi.gcp.tpu.NodeArgs;
    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.getTensorflowVersions();
    
            var tpu = new Node("tpu", NodeArgs.builder()
                .name("test-tpu")
                .zone("us-central1-b")
                .acceleratorType("v3-8")
                .tensorflowVersion(available.applyValue(getTensorflowVersionsResult -> getTensorflowVersionsResult.versions()[0]))
                .cidrBlock("10.2.0.0/29")
                .build());
    
        }
    }
    
    resources:
      tpu:
        type: gcp:tpu:Node
        properties:
          name: test-tpu
          zone: us-central1-b
          acceleratorType: v3-8
          tensorflowVersion: ${available.versions[0]}
          cidrBlock: 10.2.0.0/29
    variables:
      available:
        fn::invoke:
          Function: gcp:tpu:getTensorflowVersions
          Arguments: {}
    

    Using getTensorflowVersions

    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 getTensorflowVersions(args: GetTensorflowVersionsArgs, opts?: InvokeOptions): Promise<GetTensorflowVersionsResult>
    function getTensorflowVersionsOutput(args: GetTensorflowVersionsOutputArgs, opts?: InvokeOptions): Output<GetTensorflowVersionsResult>
    def get_tensorflow_versions(project: Optional[str] = None,
                                zone: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetTensorflowVersionsResult
    def get_tensorflow_versions_output(project: Optional[pulumi.Input[str]] = None,
                                zone: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetTensorflowVersionsResult]
    func GetTensorflowVersions(ctx *Context, args *GetTensorflowVersionsArgs, opts ...InvokeOption) (*GetTensorflowVersionsResult, error)
    func GetTensorflowVersionsOutput(ctx *Context, args *GetTensorflowVersionsOutputArgs, opts ...InvokeOption) GetTensorflowVersionsResultOutput

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

    public static class GetTensorflowVersions 
    {
        public static Task<GetTensorflowVersionsResult> InvokeAsync(GetTensorflowVersionsArgs args, InvokeOptions? opts = null)
        public static Output<GetTensorflowVersionsResult> Invoke(GetTensorflowVersionsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetTensorflowVersionsResult> getTensorflowVersions(GetTensorflowVersionsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:tpu/getTensorflowVersions:getTensorflowVersions
      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.

    getTensorflowVersions 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 TensorFlow 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 TensorFlow 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 TensorFlow 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 TensorFlow 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 TensorFlow 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 TensorFlow 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 v8.9.3 published on Monday, Nov 18, 2024 by Pulumi