UNPKG

@pulumi/yandex

Version:

A Pulumi package for creating and managing yandex cloud resources.

142 lines 6.95 kB
"use strict"; // *** 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.ComputeInstance = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * A VM instance resource. For more information, see * [the official documentation](https://cloud.yandex.com/docs/compute/concepts/vm). * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as fs from "fs"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("foo", {}); * const fooVpcSubnet = new yandex.VpcSubnet("foo", { * networkId: fooVpcNetwork.id, * zone: "ru-central1-a", * }); * const defaultComputeInstance = new yandex.ComputeInstance("default", { * bootDisk: { * initializeParams: { * imageId: "image_id", * }, * }, * metadata: { * foo: "bar", * "ssh-keys": `ubuntu:${fs.readFileSync("~/.ssh/id_rsa.pub", "utf-8")}`, * }, * networkInterfaces: [{ * subnetId: fooVpcSubnet.id, * }], * platformId: "standard-v1", * resources: { * cores: 2, * memory: 4, * }, * zone: "ru-central1-a", * }); * ``` * * ## Import * * Instances can be imported using the `ID` of an instance, e.g. * * ```sh * $ pulumi import yandex:index/computeInstance:ComputeInstance default instance_id * ``` */ class ComputeInstance extends pulumi.CustomResource { constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["allowStoppingForUpdate"] = state ? state.allowStoppingForUpdate : undefined; resourceInputs["bootDisk"] = state ? state.bootDisk : undefined; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["folderId"] = state ? state.folderId : undefined; resourceInputs["fqdn"] = state ? state.fqdn : undefined; resourceInputs["hostname"] = state ? state.hostname : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["metadata"] = state ? state.metadata : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["networkAccelerationType"] = state ? state.networkAccelerationType : undefined; resourceInputs["networkInterfaces"] = state ? state.networkInterfaces : undefined; resourceInputs["placementPolicy"] = state ? state.placementPolicy : undefined; resourceInputs["platformId"] = state ? state.platformId : undefined; resourceInputs["resources"] = state ? state.resources : undefined; resourceInputs["schedulingPolicy"] = state ? state.schedulingPolicy : undefined; resourceInputs["secondaryDisks"] = state ? state.secondaryDisks : undefined; resourceInputs["serviceAccountId"] = state ? state.serviceAccountId : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["zone"] = state ? state.zone : undefined; } else { const args = argsOrState; if ((!args || args.bootDisk === undefined) && !opts.urn) { throw new Error("Missing required property 'bootDisk'"); } if ((!args || args.networkInterfaces === undefined) && !opts.urn) { throw new Error("Missing required property 'networkInterfaces'"); } if ((!args || args.resources === undefined) && !opts.urn) { throw new Error("Missing required property 'resources'"); } resourceInputs["allowStoppingForUpdate"] = args ? args.allowStoppingForUpdate : undefined; resourceInputs["bootDisk"] = args ? args.bootDisk : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["folderId"] = args ? args.folderId : undefined; resourceInputs["hostname"] = args ? args.hostname : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["metadata"] = args ? args.metadata : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["networkAccelerationType"] = args ? args.networkAccelerationType : undefined; resourceInputs["networkInterfaces"] = args ? args.networkInterfaces : undefined; resourceInputs["placementPolicy"] = args ? args.placementPolicy : undefined; resourceInputs["platformId"] = args ? args.platformId : undefined; resourceInputs["resources"] = args ? args.resources : undefined; resourceInputs["schedulingPolicy"] = args ? args.schedulingPolicy : undefined; resourceInputs["secondaryDisks"] = args ? args.secondaryDisks : undefined; resourceInputs["serviceAccountId"] = args ? args.serviceAccountId : undefined; resourceInputs["zone"] = args ? args.zone : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["fqdn"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ComputeInstance.__pulumiType, name, resourceInputs, opts); } /** * Get an existing ComputeInstance 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 ComputeInstance(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of ComputeInstance. 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'] === ComputeInstance.__pulumiType; } } exports.ComputeInstance = ComputeInstance; /** @internal */ ComputeInstance.__pulumiType = 'yandex:index/computeInstance:ComputeInstance'; //# sourceMappingURL=computeInstance.js.map