NodeArgs

data class NodeArgs(val acceleratorType: Output<String>? = null, val cidrBlock: Output<String>? = null, val description: Output<String>? = null, val labels: Output<Map<String, String>>? = null, val name: Output<String>? = null, val network: Output<String>? = null, val project: Output<String>? = null, val schedulingConfig: Output<NodeSchedulingConfigArgs>? = null, val tensorflowVersion: Output<String>? = null, val useServiceNetworking: Output<Boolean>? = null, val zone: Output<String>? = null) : ConvertibleToJava<NodeArgs>

A Cloud TPU instance. To get more information about Node, see:

Example Usage

Tpu Node Basic

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")
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 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
})
}
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: {}

Tpu Node Full

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const available = gcp.tpu.getTensorflowVersions({});
const network = new gcp.compute.Network("network", {name: "tpu-node-network"});
const serviceRange = new gcp.compute.GlobalAddress("service_range", {
name: "my-global-address",
purpose: "VPC_PEERING",
addressType: "INTERNAL",
prefixLength: 16,
network: network.id,
});
const privateServiceConnection = new gcp.servicenetworking.Connection("private_service_connection", {
network: network.id,
service: "servicenetworking.googleapis.com",
reservedPeeringRanges: [serviceRange&#46;name],
});
const tpu = new gcp.tpu.Node("tpu", {
name: "test-tpu",
zone: "us-central1-b",
acceleratorType: "v3-8",
tensorflowVersion: available.then(available => available.versions?.[0]),
description: "Google Provider test TPU",
useServiceNetworking: true,
network: privateServiceConnection.network,
labels: {
foo: "bar",
},
schedulingConfig: {
preemptible: true,
},
});
import pulumi
import pulumi_gcp as gcp
available = gcp.tpu.get_tensorflow_versions()
network = gcp.compute.Network("network", name="tpu-node-network")
service_range = gcp.compute.GlobalAddress("service_range",
name="my-global-address",
purpose="VPC_PEERING",
address_type="INTERNAL",
prefix_length=16,
network=network.id)
private_service_connection = gcp.servicenetworking.Connection("private_service_connection",
network=network.id,
service="servicenetworking.googleapis.com",
reserved_peering_ranges=[service_range&#46;name])
tpu = gcp.tpu.Node("tpu",
name="test-tpu",
zone="us-central1-b",
accelerator_type="v3-8",
tensorflow_version=available.versions[0],
description="Google Provider test TPU",
use_service_networking=True,
network=private_service_connection.network,
labels={
"foo": "bar",
},
scheduling_config={
"preemptible": True,
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var available = Gcp.Tpu.GetTensorflowVersions.Invoke();
var network = new Gcp.Compute.Network("network", new()
{
Name = "tpu-node-network",
});
var serviceRange = new Gcp.Compute.GlobalAddress("service_range", new()
{
Name = "my-global-address",
Purpose = "VPC_PEERING",
AddressType = "INTERNAL",
PrefixLength = 16,
Network = network.Id,
});
var privateServiceConnection = new Gcp.ServiceNetworking.Connection("private_service_connection", new()
{
Network = network.Id,
Service = "servicenetworking.googleapis.com",
ReservedPeeringRanges = new[]
{
serviceRange.Name,
},
});
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]),
Description = "Google Provider test TPU",
UseServiceNetworking = true,
Network = privateServiceConnection.Network,
Labels =
{
{ "foo", "bar" },
},
SchedulingConfig = new Gcp.Tpu.Inputs.NodeSchedulingConfigArgs
{
Preemptible = true,
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/servicenetworking"
"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
}
network, err := compute.NewNetwork(ctx, "network", &compute.NetworkArgs{
Name: pulumi.String("tpu-node-network"),
})
if err != nil {
return err
}
serviceRange, err := compute.NewGlobalAddress(ctx, "service_range", &compute.GlobalAddressArgs{
Name: pulumi.String("my-global-address"),
Purpose: pulumi.String("VPC_PEERING"),
AddressType: pulumi.String("INTERNAL"),
PrefixLength: pulumi.Int(16),
Network: network.ID(),
})
if err != nil {
return err
}
privateServiceConnection, err := servicenetworking.NewConnection(ctx, "private_service_connection", &servicenetworking.ConnectionArgs{
Network: network.ID(),
Service: pulumi.String("servicenetworking.googleapis.com"),
ReservedPeeringRanges: pulumi.StringArray{
serviceRange.Name,
},
})
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]),
Description: pulumi.String("Google Provider test TPU"),
UseServiceNetworking: pulumi.Bool(true),
Network: privateServiceConnection.Network,
Labels: pulumi.StringMap{
"foo": pulumi.String("bar"),
},
SchedulingConfig: &tpu.NodeSchedulingConfigArgs{
Preemptible: pulumi.Bool(true),
},
})
if err != nil {
return err
}
return nil
})
}
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.compute.Network;
import com.pulumi.gcp.compute.NetworkArgs;
import com.pulumi.gcp.compute.GlobalAddress;
import com.pulumi.gcp.compute.GlobalAddressArgs;
import com.pulumi.gcp.servicenetworking.Connection;
import com.pulumi.gcp.servicenetworking.ConnectionArgs;
import com.pulumi.gcp.tpu.Node;
import com.pulumi.gcp.tpu.NodeArgs;
import com.pulumi.gcp.tpu.inputs.NodeSchedulingConfigArgs;
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 network = new Network("network", NetworkArgs.builder()
.name("tpu-node-network")
.build());
var serviceRange = new GlobalAddress("serviceRange", GlobalAddressArgs.builder()
.name("my-global-address")
.purpose("VPC_PEERING")
.addressType("INTERNAL")
.prefixLength(16)
.network(network.id())
.build());
var privateServiceConnection = new Connection("privateServiceConnection", ConnectionArgs.builder()
.network(network.id())
.service("servicenetworking.googleapis.com")
.reservedPeeringRanges(serviceRange.name())
.build());
var tpu = new Node("tpu", NodeArgs.builder()
.name("test-tpu")
.zone("us-central1-b")
.acceleratorType("v3-8")
.tensorflowVersion(available.applyValue(getTensorflowVersionsResult -> getTensorflowVersionsResult.versions()[0]))
.description("Google Provider test TPU")
.useServiceNetworking(true)
.network(privateServiceConnection.network())
.labels(Map.of("foo", "bar"))
.schedulingConfig(NodeSchedulingConfigArgs.builder()
.preemptible(true)
.build())
.build());
}
}
resources:
tpu:
type: gcp:tpu:Node
properties:
name: test-tpu
zone: us-central1-b
acceleratorType: v3-8
tensorflowVersion: ${available.versions[0]}
description: Google Provider test TPU
useServiceNetworking: true
network: ${privateServiceConnection.network}
labels:
foo: bar
schedulingConfig:
preemptible: true
network:
type: gcp:compute:Network
properties:
name: tpu-node-network
serviceRange:
type: gcp:compute:GlobalAddress
name: service_range
properties:
name: my-global-address
purpose: VPC_PEERING
addressType: INTERNAL
prefixLength: 16
network: ${network.id}
privateServiceConnection:
type: gcp:servicenetworking:Connection
name: private_service_connection
properties:
network: ${network.id}
service: servicenetworking.googleapis.com
reservedPeeringRanges:
- ${serviceRange.name}
variables:
available:
fn::invoke:
Function: gcp:tpu:getTensorflowVersions
Arguments: {}

Import

Node 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, Node can be imported using one of the formats above. For example:

$ pulumi import gcp:tpu/node:Node default projects/{{project}}/locations/{{zone}}/nodes/{{name}}
$ pulumi import gcp:tpu/node:Node default {{project}}/{{zone}}/{{name}}
$ pulumi import gcp:tpu/node:Node default {{zone}}/{{name}}
$ pulumi import gcp:tpu/node:Node default {{name}}

Constructors

Link copied to clipboard
constructor(acceleratorType: Output<String>? = null, cidrBlock: Output<String>? = null, description: Output<String>? = null, labels: Output<Map<String, String>>? = null, name: Output<String>? = null, network: Output<String>? = null, project: Output<String>? = null, schedulingConfig: Output<NodeSchedulingConfigArgs>? = null, tensorflowVersion: Output<String>? = null, useServiceNetworking: Output<Boolean>? = null, zone: Output<String>? = null)

Properties

Link copied to clipboard
val acceleratorType: Output<String>? = null

The type of hardware accelerators associated with this node.

Link copied to clipboard
val cidrBlock: Output<String>? = null

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.

Link copied to clipboard
val description: Output<String>? = null

The user-supplied description of the TPU. Maximum of 512 characters.

Link copied to clipboard
val labels: Output<Map<String, String>>? = null

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.

Link copied to clipboard
val name: Output<String>? = null

The immutable name of the TPU.

Link copied to clipboard
val network: Output<String>? = null

The name of a network to peer the TPU node to. It must be a preexisting Compute Engine network inside of the project on which this API has been activated. If none is provided, "default" will be used.

Link copied to clipboard
val project: Output<String>? = null

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard

Sets the scheduling options for this TPU instance. Structure is documented below.

Link copied to clipboard
val tensorflowVersion: Output<String>? = null

The version of Tensorflow running in the Node.

Link copied to clipboard
val useServiceNetworking: Output<Boolean>? = null

Whether the VPC peering for the node is set up through Service Networking API. The VPC Peering should be set up before provisioning the node. If this field is set, cidr_block field should not be specified. If the network that you want to peer the TPU Node to is a Shared VPC network, the node must be created with this this field enabled.

Link copied to clipboard
val zone: Output<String>? = null

The GCP location for the TPU. If it is not provided, the provider zone is used.

Functions

Link copied to clipboard
open override fun toJava(): NodeArgs