UNPKG

@pulumi/linode

Version:

A Pulumi package for creating and managing linode cloud resources.

229 lines • 10.4 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.Instance = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a Linode Instance resource. This can be used to create, modify, and delete Linodes. * For more information, see [Getting Started with Linode](https://linode.com/docs/getting-started/) and the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-linode-instance). * * ## Example Usage * * ### Simple Linode Instance * * The following example shows how one might use this resource to configure a Linode instance. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * const web = new linode.Instance("web", { * label: "simple_instance", * image: "linode/ubuntu22.04", * region: "us-central", * type: "g6-standard-1", * authorizedKeys: ["ssh-rsa AAAA...Gw== user@example.local"], * rootPass: "this-is-not-a-safe-password", * tags: ["foo"], * swapSize: 256, * privateIp: true, * }); * ``` * * ### Linode Instance with Explicit Networking Interfaces * * You can add a VPC or VLAN interface directly to a Linode instance resource. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * const web = new linode.Instance("web", { * label: "simple_instance", * image: "linode/ubuntu22.04", * region: "us-central", * type: "g6-standard-1", * authorizedKeys: ["ssh-rsa AAAA...Gw== user@example.local"], * rootPass: "this-is-not-a-safe-password", * interfaces: [ * { * purpose: "public", * }, * { * purpose: "vpc", * subnetId: 123, * ipv4: { * vpc: "10.0.4.250", * }, * }, * ], * tags: ["foo"], * swapSize: 256, * privateIp: true, * }); * ``` * * ### Linode Instance Assigned to a Placement Group * * The following example shows how one might use this resource to configure a Linode instance assigned to a * Placement Group. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * const my_instance = new linode.Instance("my-instance", { * label: "my-instance", * region: "us-mia", * type: "g6-standard-1", * placementGroup: { * id: 12345, * }, * }); * ``` * * ## Import * * Linodes Instances can be imported using the Linode `id`, e.g. * * ```sh * $ pulumi import linode:index/instance:Instance mylinode 1234567 * ``` * * When importing an instance, all `disk` and `config` values must be represented. * * Imported disks must include their `label` value. **Any disk that is not precisely represented may be removed resulting in data loss.** * * Imported configs should include all `devices`, and must include `label`, `kernel`, and the `root_device`. The instance must include a `boot_config_label` referring to the correct configuration profile. */ class Instance extends pulumi.CustomResource { /** * Get an existing Instance 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 Instance(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Instance. 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'] === Instance.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["alerts"] = state?.alerts; resourceInputs["authorizedKeys"] = state?.authorizedKeys; resourceInputs["authorizedUsers"] = state?.authorizedUsers; resourceInputs["backupId"] = state?.backupId; resourceInputs["backups"] = state?.backups; resourceInputs["backupsEnabled"] = state?.backupsEnabled; resourceInputs["bootConfigLabel"] = state?.bootConfigLabel; resourceInputs["booted"] = state?.booted; resourceInputs["capabilities"] = state?.capabilities; resourceInputs["configs"] = state?.configs; resourceInputs["diskEncryption"] = state?.diskEncryption; resourceInputs["disks"] = state?.disks; resourceInputs["firewallId"] = state?.firewallId; resourceInputs["group"] = state?.group; resourceInputs["hasUserData"] = state?.hasUserData; resourceInputs["hostUuid"] = state?.hostUuid; resourceInputs["image"] = state?.image; resourceInputs["interfaces"] = state?.interfaces; resourceInputs["ipAddress"] = state?.ipAddress; resourceInputs["ipv4s"] = state?.ipv4s; resourceInputs["ipv6"] = state?.ipv6; resourceInputs["label"] = state?.label; resourceInputs["lkeClusterId"] = state?.lkeClusterId; resourceInputs["maintenancePolicy"] = state?.maintenancePolicy; resourceInputs["metadatas"] = state?.metadatas; resourceInputs["migrationType"] = state?.migrationType; resourceInputs["placementGroup"] = state?.placementGroup; resourceInputs["placementGroupExternallyManaged"] = state?.placementGroupExternallyManaged; resourceInputs["privateIp"] = state?.privateIp; resourceInputs["privateIpAddress"] = state?.privateIpAddress; resourceInputs["region"] = state?.region; resourceInputs["resizeDisk"] = state?.resizeDisk; resourceInputs["rootPass"] = state?.rootPass; resourceInputs["sharedIpv4s"] = state?.sharedIpv4s; resourceInputs["specs"] = state?.specs; resourceInputs["stackscriptData"] = state?.stackscriptData; resourceInputs["stackscriptId"] = state?.stackscriptId; resourceInputs["status"] = state?.status; resourceInputs["swapSize"] = state?.swapSize; resourceInputs["tags"] = state?.tags; resourceInputs["type"] = state?.type; resourceInputs["watchdogEnabled"] = state?.watchdogEnabled; } else { const args = argsOrState; if (args?.region === undefined && !opts.urn) { throw new Error("Missing required property 'region'"); } resourceInputs["alerts"] = args?.alerts; resourceInputs["authorizedKeys"] = args?.authorizedKeys; resourceInputs["authorizedUsers"] = args?.authorizedUsers; resourceInputs["backupId"] = args?.backupId; resourceInputs["backupsEnabled"] = args?.backupsEnabled; resourceInputs["bootConfigLabel"] = args?.bootConfigLabel; resourceInputs["booted"] = args?.booted; resourceInputs["configs"] = args?.configs; resourceInputs["diskEncryption"] = args?.diskEncryption; resourceInputs["disks"] = args?.disks; resourceInputs["firewallId"] = args?.firewallId; resourceInputs["group"] = args?.group; resourceInputs["image"] = args?.image; resourceInputs["interfaces"] = args?.interfaces; resourceInputs["ipv4s"] = args?.ipv4s; resourceInputs["label"] = args?.label; resourceInputs["maintenancePolicy"] = args?.maintenancePolicy; resourceInputs["metadatas"] = args?.metadatas; resourceInputs["migrationType"] = args?.migrationType; resourceInputs["placementGroup"] = args?.placementGroup; resourceInputs["placementGroupExternallyManaged"] = args?.placementGroupExternallyManaged; resourceInputs["privateIp"] = args?.privateIp; resourceInputs["region"] = args?.region; resourceInputs["resizeDisk"] = args?.resizeDisk; resourceInputs["rootPass"] = args?.rootPass ? pulumi.secret(args.rootPass) : undefined; resourceInputs["sharedIpv4s"] = args?.sharedIpv4s; resourceInputs["stackscriptData"] = args?.stackscriptData ? pulumi.secret(args.stackscriptData) : undefined; resourceInputs["stackscriptId"] = args?.stackscriptId; resourceInputs["swapSize"] = args?.swapSize; resourceInputs["tags"] = args?.tags; resourceInputs["type"] = args?.type; resourceInputs["watchdogEnabled"] = args?.watchdogEnabled; resourceInputs["backups"] = undefined /*out*/; resourceInputs["capabilities"] = undefined /*out*/; resourceInputs["hasUserData"] = undefined /*out*/; resourceInputs["hostUuid"] = undefined /*out*/; resourceInputs["ipAddress"] = undefined /*out*/; resourceInputs["ipv6"] = undefined /*out*/; resourceInputs["lkeClusterId"] = undefined /*out*/; resourceInputs["privateIpAddress"] = undefined /*out*/; resourceInputs["specs"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["rootPass", "stackscriptData"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(Instance.__pulumiType, name, resourceInputs, opts); } } exports.Instance = Instance; /** @internal */ Instance.__pulumiType = 'linode:index/instance:Instance'; //# sourceMappingURL=instance.js.map