Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi
gcp.tpu.getTensorflowVersions
Explore with Pulumi AI
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/v7/go/gcp/tpu"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := tpu.GetTensorflowVersions(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.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/v7/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, nil, 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:
getTensorflowVersions Result
The following output properties are available:
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.