UNPKG

@pulumi/linode

Version:

A Pulumi package for creating and managing linode cloud resources.

148 lines 6.92 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.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.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, Object.assign(Object.assign({}, 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 ? state.authorizedKeys : undefined; resourceInputs["authorizedUsers"] = state ? state.authorizedUsers : undefined; resourceInputs["created"] = state ? state.created : undefined; resourceInputs["diskEncryption"] = state ? state.diskEncryption : undefined; resourceInputs["filesystem"] = state ? state.filesystem : undefined; resourceInputs["image"] = state ? state.image : undefined; resourceInputs["label"] = state ? state.label : undefined; resourceInputs["linodeId"] = state ? state.linodeId : undefined; resourceInputs["rootPass"] = state ? state.rootPass : undefined; resourceInputs["size"] = state ? state.size : undefined; resourceInputs["stackscriptData"] = state ? state.stackscriptData : undefined; resourceInputs["stackscriptId"] = state ? state.stackscriptId : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["timeouts"] = state ? state.timeouts : undefined; resourceInputs["updated"] = state ? state.updated : undefined; } else { const args = argsOrState; if ((!args || args.label === undefined) && !opts.urn) { throw new Error("Missing required property 'label'"); } if ((!args || args.linodeId === undefined) && !opts.urn) { throw new Error("Missing required property 'linodeId'"); } if ((!args || args.size === undefined) && !opts.urn) { throw new Error("Missing required property 'size'"); } resourceInputs["authorizedKeys"] = args ? args.authorizedKeys : undefined; resourceInputs["authorizedUsers"] = args ? args.authorizedUsers : undefined; resourceInputs["filesystem"] = args ? args.filesystem : undefined; resourceInputs["image"] = args ? args.image : undefined; resourceInputs["label"] = args ? args.label : undefined; resourceInputs["linodeId"] = args ? args.linodeId : undefined; resourceInputs["rootPass"] = (args === null || args === void 0 ? void 0 : args.rootPass) ? pulumi.secret(args.rootPass) : undefined; resourceInputs["size"] = args ? args.size : undefined; resourceInputs["stackscriptData"] = (args === null || args === void 0 ? void 0 : args.stackscriptData) ? pulumi.secret(args.stackscriptData) : undefined; resourceInputs["stackscriptId"] = args ? args.stackscriptId : undefined; resourceInputs["timeouts"] = args ? args.timeouts : undefined; 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