@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
194 lines • 6.83 kB
JavaScript
;
// *** 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.InstanceConfig = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* ## Example Usage
*
* Creating a simple bootable Linode Instance Configuration Profile:
*
* ```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!",
* });
* const my_config = new linode.InstanceConfig("my-config", {
* linodeId: my_instance.id,
* label: "my-config",
* devices: [{
* deviceName: "sda",
* diskId: boot.id,
* }],
* booted: true,
* });
* ```
*
* Creating a complex bootable Instance Configuration Profile with a VPC:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* // Create a VPC and a subnet
* const foobar = new linode.Vpc("foobar", {
* label: "my-vpc",
* region: "us-mia",
* description: "test description",
* });
* const foobarVpcSubnet = new linode.VpcSubnet("foobar", {
* vpcId: foobar.id,
* label: "my-subnet",
* ipv4: "10.0.4.0/24",
* });
* const my_instance = new linode.Instance("my-instance", {
* label: "my-instance",
* type: "g6-standard-1",
* region: "us-mia",
* });
* // Create a boot disk
* const boot = new linode.InstanceDisk("boot", {
* label: "boot",
* linodeId: my_instance.id,
* size: my_instance.specs.apply(specs => specs[0].disk - 512),
* image: "linode/ubuntu22.04",
* rootPass: "myc00lpass!ciuw23asxbviwuc",
* });
* // Create a swap disk
* const swap = new linode.InstanceDisk("swap", {
* label: "swap",
* linodeId: my_instance.id,
* size: 512,
* filesystem: "swap",
* });
* const my_config = new linode.InstanceConfig("my-config", {
* linodeId: my_instance.id,
* label: "my-config",
* devices: [
* {
* deviceName: "sda",
* diskId: boot.id,
* },
* {
* deviceName: "sdb",
* diskId: swap.id,
* },
* ],
* helpers: [{
* updatedbDisabled: false,
* }],
* interfaces: [
* {
* purpose: "public",
* },
* {
* purpose: "vlan",
* label: "my-vlan",
* ipamAddress: "10.0.0.2/24",
* },
* {
* purpose: "vpc",
* subnetId: foobarVpcSubnet.id,
* ipv4: {
* vpc: "10.0.4.250",
* },
* },
* ],
* booted: true,
* });
* // Unsupported provisioner type remote-exec
* ```
*
* ## Import
*
* Instance Configs can be imported using the `linode_id` followed by the Instance Config `id` separated by a comma, e.g.
*
* ```sh
* $ pulumi import linode:index/instanceConfig:InstanceConfig my-config 1234567,7654321
* ```
*/
class InstanceConfig extends pulumi.CustomResource {
/**
* Get an existing InstanceConfig 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 InstanceConfig(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of InstanceConfig. 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'] === InstanceConfig.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["booted"] = state?.booted;
resourceInputs["comments"] = state?.comments;
resourceInputs["device"] = state?.device;
resourceInputs["devices"] = state?.devices;
resourceInputs["helpers"] = state?.helpers;
resourceInputs["interfaces"] = state?.interfaces;
resourceInputs["kernel"] = state?.kernel;
resourceInputs["label"] = state?.label;
resourceInputs["linodeId"] = state?.linodeId;
resourceInputs["memoryLimit"] = state?.memoryLimit;
resourceInputs["rootDevice"] = state?.rootDevice;
resourceInputs["runLevel"] = state?.runLevel;
resourceInputs["virtMode"] = state?.virtMode;
}
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'");
}
resourceInputs["booted"] = args?.booted;
resourceInputs["comments"] = args?.comments;
resourceInputs["device"] = args?.device;
resourceInputs["devices"] = args?.devices;
resourceInputs["helpers"] = args?.helpers;
resourceInputs["interfaces"] = args?.interfaces;
resourceInputs["kernel"] = args?.kernel;
resourceInputs["label"] = args?.label;
resourceInputs["linodeId"] = args?.linodeId;
resourceInputs["memoryLimit"] = args?.memoryLimit;
resourceInputs["rootDevice"] = args?.rootDevice;
resourceInputs["runLevel"] = args?.runLevel;
resourceInputs["virtMode"] = args?.virtMode;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(InstanceConfig.__pulumiType, name, resourceInputs, opts);
}
}
exports.InstanceConfig = InstanceConfig;
/** @internal */
InstanceConfig.__pulumiType = 'linode:index/instanceConfig:InstanceConfig';
//# sourceMappingURL=instanceConfig.js.map