UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

384 lines (383 loc) • 14.7 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * A Cloud TPU instance. * * To get more information about Node, see: * * * [API documentation](https://cloud.google.com/tpu/docs/reference/rest/v1/projects.locations.nodes) * * How-to Guides * * [Official Documentation](https://cloud.google.com/tpu/docs/) * * ## Example Usage * * ### Tpu Node Basic * * ```typescript * 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", * }); * ``` * ### Tpu Node Full * * ```typescript * 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.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 * * 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: * * ```sh * $ pulumi import gcp:tpu/node:Node default projects/{{project}}/locations/{{zone}}/nodes/{{name}} * ``` * * ```sh * $ pulumi import gcp:tpu/node:Node default {{project}}/{{zone}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:tpu/node:Node default {{zone}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:tpu/node:Node default {{name}} * ``` */ export declare class Node extends pulumi.CustomResource { /** * Get an existing Node resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: NodeState, opts?: pulumi.CustomResourceOptions): Node; /** * Returns true if the given object is an instance of Node. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Node; /** * The type of hardware accelerators associated with this node. */ readonly acceleratorType: pulumi.Output<string>; /** * 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. */ readonly cidrBlock: pulumi.Output<string>; /** * The user-supplied description of the TPU. Maximum of 512 characters. */ readonly description: pulumi.Output<string | undefined>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * 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 `effectiveLabels` for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The immutable name of the TPU. */ readonly name: pulumi.Output<string>; /** * 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. */ readonly network: pulumi.Output<string>; /** * The network endpoints where TPU workers can be accessed and sent work. * It is recommended that Tensorflow clients of the node first reach out * to the first (index 0) entry. * Structure is documented below. */ readonly networkEndpoints: pulumi.Output<outputs.tpu.NodeNetworkEndpoint[]>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * Sets the scheduling options for this TPU instance. * Structure is documented below. */ readonly schedulingConfig: pulumi.Output<outputs.tpu.NodeSchedulingConfig | undefined>; /** * The service account used to run the tensor flow services within the * node. To share resources, including Google Cloud Storage data, with * the Tensorflow job running in the Node, this account must have * permissions to that data. */ readonly serviceAccount: pulumi.Output<string>; /** * The version of Tensorflow running in the Node. * * * - - - */ readonly tensorflowVersion: pulumi.Output<string>; /** * 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, * cidrBlock 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. */ readonly useServiceNetworking: pulumi.Output<boolean | undefined>; /** * The GCP location for the TPU. If it is not provided, the provider zone is used. */ readonly zone: pulumi.Output<string>; /** * Create a Node resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: NodeArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Node resources. */ export interface NodeState { /** * The type of hardware accelerators associated with this node. */ acceleratorType?: pulumi.Input<string>; /** * 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. */ cidrBlock?: pulumi.Input<string>; /** * The user-supplied description of the TPU. Maximum of 512 characters. */ description?: pulumi.Input<string>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * 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 `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The immutable name of the TPU. */ name?: pulumi.Input<string>; /** * 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. */ network?: pulumi.Input<string>; /** * The network endpoints where TPU workers can be accessed and sent work. * It is recommended that Tensorflow clients of the node first reach out * to the first (index 0) entry. * Structure is documented below. */ networkEndpoints?: pulumi.Input<pulumi.Input<inputs.tpu.NodeNetworkEndpoint>[]>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Sets the scheduling options for this TPU instance. * Structure is documented below. */ schedulingConfig?: pulumi.Input<inputs.tpu.NodeSchedulingConfig>; /** * The service account used to run the tensor flow services within the * node. To share resources, including Google Cloud Storage data, with * the Tensorflow job running in the Node, this account must have * permissions to that data. */ serviceAccount?: pulumi.Input<string>; /** * The version of Tensorflow running in the Node. * * * - - - */ tensorflowVersion?: pulumi.Input<string>; /** * 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, * cidrBlock 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. */ useServiceNetworking?: pulumi.Input<boolean>; /** * The GCP location for the TPU. If it is not provided, the provider zone is used. */ zone?: pulumi.Input<string>; } /** * The set of arguments for constructing a Node resource. */ export interface NodeArgs { /** * The type of hardware accelerators associated with this node. */ acceleratorType: pulumi.Input<string>; /** * 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. */ cidrBlock?: pulumi.Input<string>; /** * The user-supplied description of the TPU. Maximum of 512 characters. */ description?: pulumi.Input<string>; /** * 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 `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The immutable name of the TPU. */ name?: pulumi.Input<string>; /** * 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. */ network?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * Sets the scheduling options for this TPU instance. * Structure is documented below. */ schedulingConfig?: pulumi.Input<inputs.tpu.NodeSchedulingConfig>; /** * The version of Tensorflow running in the Node. * * * - - - */ tensorflowVersion: pulumi.Input<string>; /** * 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, * cidrBlock 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. */ useServiceNetworking?: pulumi.Input<boolean>; /** * The GCP location for the TPU. If it is not provided, the provider zone is used. */ zone?: pulumi.Input<string>; }