UNPKG

@pulumi/linode

Version:

A Pulumi package for creating and managing linode cloud resources.

148 lines 6.31 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.InstanceDisk = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a Linode Instance Disk resource. This can be used to create, modify, and delete Linode Instance Disks. * For more information, see the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-add-linode-disk). * * **NOTE:** Deleting a disk will shut down the attached instance if the instance is booted. If the disk was not in use by the booted configuration profile, the instance will be automatically rebooted. * * ## Example Usage * * Creating a simple 512 MB Linode Instance Disk: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * const my_instance = new linode.Instance("my-instance", { * label: "my-instance", * type: "g6-standard-1", * region: "us-southeast", * }); * const boot = new linode.InstanceDisk("boot", { * label: "boot", * linodeId: my_instance.id, * size: 512, * filesystem: "ext4", * }); * ``` * * Creating a complex bootable Instance Disk: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * const my_instance = new linode.Instance("my-instance", { * label: "my-instance", * type: "g6-standard-1", * region: "us-southeast", * }); * const boot = new linode.InstanceDisk("boot", { * label: "boot", * linodeId: my_instance.id, * size: my_instance.specs.apply(specs => specs[0].disk), * image: "linode/ubuntu22.04", * rootPass: "myc00lpass!", * authorizedKeys: ["ssh-rsa AAAA...Gw== user@example.local"], * stackscriptId: 12345, * stackscriptData: { * my_var: "my_value", * }, * }); * ``` * * ## Import * * Instance Disks can be imported using the `linode_id` followed by the Instance Disk `id` separated by a comma, e.g. * * ```sh * $ pulumi import linode:index/instanceDisk:InstanceDisk my-disk 1234567,7654321 * ``` */ class InstanceDisk extends pulumi.CustomResource { /** * Get an existing InstanceDisk 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 InstanceDisk(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of InstanceDisk. 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'] === InstanceDisk.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["authorizedKeys"] = state?.authorizedKeys; resourceInputs["authorizedUsers"] = state?.authorizedUsers; resourceInputs["created"] = state?.created; resourceInputs["diskEncryption"] = state?.diskEncryption; resourceInputs["filesystem"] = state?.filesystem; resourceInputs["image"] = state?.image; resourceInputs["label"] = state?.label; resourceInputs["linodeId"] = state?.linodeId; resourceInputs["rootPass"] = state?.rootPass; resourceInputs["size"] = state?.size; resourceInputs["stackscriptData"] = state?.stackscriptData; resourceInputs["stackscriptId"] = state?.stackscriptId; resourceInputs["status"] = state?.status; resourceInputs["timeouts"] = state?.timeouts; resourceInputs["updated"] = state?.updated; } else { const args = argsOrState; if (args?.label === undefined && !opts.urn) { throw new Error("Missing required property 'label'"); } if (args?.linodeId === undefined && !opts.urn) { throw new Error("Missing required property 'linodeId'"); } if (args?.size === undefined && !opts.urn) { throw new Error("Missing required property 'size'"); } resourceInputs["authorizedKeys"] = args?.authorizedKeys; resourceInputs["authorizedUsers"] = args?.authorizedUsers; resourceInputs["filesystem"] = args?.filesystem; resourceInputs["image"] = args?.image; resourceInputs["label"] = args?.label; resourceInputs["linodeId"] = args?.linodeId; resourceInputs["rootPass"] = args?.rootPass ? pulumi.secret(args.rootPass) : undefined; resourceInputs["size"] = args?.size; resourceInputs["stackscriptData"] = args?.stackscriptData ? pulumi.secret(args.stackscriptData) : undefined; resourceInputs["stackscriptId"] = args?.stackscriptId; resourceInputs["timeouts"] = args?.timeouts; resourceInputs["created"] = undefined /*out*/; resourceInputs["diskEncryption"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; resourceInputs["updated"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["rootPass", "stackscriptData"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(InstanceDisk.__pulumiType, name, resourceInputs, opts); } } exports.InstanceDisk = InstanceDisk; /** @internal */ InstanceDisk.__pulumiType = 'linode:index/instanceDisk:InstanceDisk'; //# sourceMappingURL=instanceDisk.js.map