@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
178 lines • 7.41 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Node = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* 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}}
* ```
*/
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, id, state, opts) {
return new Node(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* 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) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Node.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["acceleratorType"] = state ? state.acceleratorType : undefined;
resourceInputs["cidrBlock"] = state ? state.cidrBlock : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["network"] = state ? state.network : undefined;
resourceInputs["networkEndpoints"] = state ? state.networkEndpoints : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["schedulingConfig"] = state ? state.schedulingConfig : undefined;
resourceInputs["serviceAccount"] = state ? state.serviceAccount : undefined;
resourceInputs["tensorflowVersion"] = state ? state.tensorflowVersion : undefined;
resourceInputs["useServiceNetworking"] = state ? state.useServiceNetworking : undefined;
resourceInputs["zone"] = state ? state.zone : undefined;
}
else {
const args = argsOrState;
if ((!args || args.acceleratorType === undefined) && !opts.urn) {
throw new Error("Missing required property 'acceleratorType'");
}
if ((!args || args.tensorflowVersion === undefined) && !opts.urn) {
throw new Error("Missing required property 'tensorflowVersion'");
}
resourceInputs["acceleratorType"] = args ? args.acceleratorType : undefined;
resourceInputs["cidrBlock"] = args ? args.cidrBlock : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["network"] = args ? args.network : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["schedulingConfig"] = args ? args.schedulingConfig : undefined;
resourceInputs["tensorflowVersion"] = args ? args.tensorflowVersion : undefined;
resourceInputs["useServiceNetworking"] = args ? args.useServiceNetworking : undefined;
resourceInputs["zone"] = args ? args.zone : undefined;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["networkEndpoints"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["serviceAccount"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Node.__pulumiType, name, resourceInputs, opts);
}
}
exports.Node = Node;
/** @internal */
Node.__pulumiType = 'gcp:tpu/node:Node';
//# sourceMappingURL=node.js.map