@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
227 lines • 11.7 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.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, Object.assign(Object.assign({}, 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 ? state.alerts : undefined;
resourceInputs["authorizedKeys"] = state ? state.authorizedKeys : undefined;
resourceInputs["authorizedUsers"] = state ? state.authorizedUsers : undefined;
resourceInputs["backupId"] = state ? state.backupId : undefined;
resourceInputs["backups"] = state ? state.backups : undefined;
resourceInputs["backupsEnabled"] = state ? state.backupsEnabled : undefined;
resourceInputs["bootConfigLabel"] = state ? state.bootConfigLabel : undefined;
resourceInputs["booted"] = state ? state.booted : undefined;
resourceInputs["capabilities"] = state ? state.capabilities : undefined;
resourceInputs["configs"] = state ? state.configs : undefined;
resourceInputs["diskEncryption"] = state ? state.diskEncryption : undefined;
resourceInputs["disks"] = state ? state.disks : undefined;
resourceInputs["firewallId"] = state ? state.firewallId : undefined;
resourceInputs["group"] = state ? state.group : undefined;
resourceInputs["hasUserData"] = state ? state.hasUserData : undefined;
resourceInputs["hostUuid"] = state ? state.hostUuid : undefined;
resourceInputs["image"] = state ? state.image : undefined;
resourceInputs["interfaces"] = state ? state.interfaces : undefined;
resourceInputs["ipAddress"] = state ? state.ipAddress : undefined;
resourceInputs["ipv4s"] = state ? state.ipv4s : undefined;
resourceInputs["ipv6"] = state ? state.ipv6 : undefined;
resourceInputs["label"] = state ? state.label : undefined;
resourceInputs["lkeClusterId"] = state ? state.lkeClusterId : undefined;
resourceInputs["metadatas"] = state ? state.metadatas : undefined;
resourceInputs["migrationType"] = state ? state.migrationType : undefined;
resourceInputs["placementGroup"] = state ? state.placementGroup : undefined;
resourceInputs["placementGroupExternallyManaged"] = state ? state.placementGroupExternallyManaged : undefined;
resourceInputs["privateIp"] = state ? state.privateIp : undefined;
resourceInputs["privateIpAddress"] = state ? state.privateIpAddress : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["resizeDisk"] = state ? state.resizeDisk : undefined;
resourceInputs["rootPass"] = state ? state.rootPass : undefined;
resourceInputs["sharedIpv4s"] = state ? state.sharedIpv4s : undefined;
resourceInputs["specs"] = state ? state.specs : undefined;
resourceInputs["stackscriptData"] = state ? state.stackscriptData : undefined;
resourceInputs["stackscriptId"] = state ? state.stackscriptId : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["swapSize"] = state ? state.swapSize : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["watchdogEnabled"] = state ? state.watchdogEnabled : undefined;
}
else {
const args = argsOrState;
if ((!args || args.region === undefined) && !opts.urn) {
throw new Error("Missing required property 'region'");
}
resourceInputs["alerts"] = args ? args.alerts : undefined;
resourceInputs["authorizedKeys"] = args ? args.authorizedKeys : undefined;
resourceInputs["authorizedUsers"] = args ? args.authorizedUsers : undefined;
resourceInputs["backupId"] = args ? args.backupId : undefined;
resourceInputs["backupsEnabled"] = args ? args.backupsEnabled : undefined;
resourceInputs["bootConfigLabel"] = args ? args.bootConfigLabel : undefined;
resourceInputs["booted"] = args ? args.booted : undefined;
resourceInputs["configs"] = args ? args.configs : undefined;
resourceInputs["diskEncryption"] = args ? args.diskEncryption : undefined;
resourceInputs["disks"] = args ? args.disks : undefined;
resourceInputs["firewallId"] = args ? args.firewallId : undefined;
resourceInputs["group"] = args ? args.group : undefined;
resourceInputs["image"] = args ? args.image : undefined;
resourceInputs["interfaces"] = args ? args.interfaces : undefined;
resourceInputs["ipv4s"] = args ? args.ipv4s : undefined;
resourceInputs["label"] = args ? args.label : undefined;
resourceInputs["metadatas"] = args ? args.metadatas : undefined;
resourceInputs["migrationType"] = args ? args.migrationType : undefined;
resourceInputs["placementGroup"] = args ? args.placementGroup : undefined;
resourceInputs["placementGroupExternallyManaged"] = args ? args.placementGroupExternallyManaged : undefined;
resourceInputs["privateIp"] = args ? args.privateIp : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["resizeDisk"] = args ? args.resizeDisk : undefined;
resourceInputs["rootPass"] = (args === null || args === void 0 ? void 0 : args.rootPass) ? pulumi.secret(args.rootPass) : undefined;
resourceInputs["sharedIpv4s"] = args ? args.sharedIpv4s : undefined;
resourceInputs["stackscriptData"] = (args === null || args === void 0 ? void 0 : args.stackscriptData) ? pulumi.secret(args.stackscriptData) : undefined;
resourceInputs["stackscriptId"] = args ? args.stackscriptId : undefined;
resourceInputs["swapSize"] = args ? args.swapSize : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["watchdogEnabled"] = args ? args.watchdogEnabled : undefined;
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
;