UNPKG

@pulumi/linode

Version:

A Pulumi package for creating and managing linode cloud resources.

344 lines (343 loc) 13.9 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * Provides a Linode Instance Config resource. This can be used to create, modify, and delete Linode Instance Configs. * For more information, see the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-add-linode-config). * * > **NOTICE:** If a VPC interface is defined in your `linode.InstanceConfig` resource and the config is currently booted with the Linode, then the Linode is required to be powered off during the update operation. The Terraform provider will try to implicitly shutdown you Linode instance during the update and restart it when it's finished. Unless you explicitly config the `booted` attribute in the resource or explicitly set `skipImplicitReboots` to `false` in the Terraform provider config. * * **NOTE:** Changes to a config that is currently booted will trigger a reboot, in order to skip this explicitly set `skipImplicitReboots` to `true` in the Terraform provider config. * * **NOTE:** Deleting a config will shut down the attached instance if the config is in use. * * ## Example Usage * * ```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, * }); * ``` * ```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 `linodeId` followed by the Instance Config `id` separated by a comma, e.g. * * ```sh * $ pulumi import linode:index/instanceConfig:InstanceConfig my-config 1234567,7654321 * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: InstanceConfigState, opts?: pulumi.CustomResourceOptions): InstanceConfig; /** * 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: any): obj is InstanceConfig; /** * If true, the Linode will be booted into this config. If another config is booted, the Linode will be rebooted into this config. If false, the Linode will be shutdown only if it is currently booted into this config. If undefined, the config will alter the boot status of the Linode. */ readonly booted: pulumi.Output<boolean>; /** * Optional field for arbitrary User comments on this Config. * * * `devices` - (Optional) A dictionary of device disks to use as a device map in a Linode’s configuration profile. * * * `helpers` - (Optional) Helpers enabled when booting to this Linode Config. * * * `interface` - (Optional) An array of Network Interfaces to use for this Configuration Profile. */ readonly comments: pulumi.Output<string | undefined>; /** * Blocks for device disks in a Linode's configuration profile. */ readonly device: pulumi.Output<outputs.InstanceConfigDevice[]>; /** * A dictionary of device disks to use as a device map in a Linode's configuration profile. * * @deprecated Devices attribute is deprecated in favor of `device`. */ readonly devices: pulumi.Output<outputs.InstanceConfigDevices>; /** * Helpers enabled when booting to this Linode Config. */ readonly helpers: pulumi.Output<outputs.InstanceConfigHelper[]>; /** * An array of Network Interfaces to add to this Linode's Configuration Profile. */ readonly interfaces: pulumi.Output<outputs.InstanceConfigInterface[] | undefined>; /** * A Kernel ID to boot a Linode with. Default is `linode/latest-64bit`. Examples are `linode/latest-64bit`, `linode/grub2`, `linode/direct-disk`, etc. See all kernels [here](https://api.linode.com/v4/linode/kernels). Note that this is a paginated API endpoint ([docs](https://techdocs.akamai.com/linode-api/reference/get-kernels)). */ readonly kernel: pulumi.Output<string | undefined>; /** * The Config’s label for display purposes only. * * - - - */ readonly label: pulumi.Output<string>; /** * The ID of the Linode to create this configuration profile under. */ readonly linodeId: pulumi.Output<number>; /** * The memory limit of the Config. Defaults to the total ram of the Linode. */ readonly memoryLimit: pulumi.Output<number>; /** * The root device to boot. (default `/dev/sda`) */ readonly rootDevice: pulumi.Output<string | undefined>; /** * Defines the state of your Linode after booting. (`default`, `single`, `binbash`) */ readonly runLevel: pulumi.Output<string | undefined>; /** * Controls the virtualization mode. (`paravirt`, `fullvirt`) */ readonly virtMode: pulumi.Output<string | undefined>; /** * Create a InstanceConfig resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: InstanceConfigArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering InstanceConfig resources. */ export interface InstanceConfigState { /** * If true, the Linode will be booted into this config. If another config is booted, the Linode will be rebooted into this config. If false, the Linode will be shutdown only if it is currently booted into this config. If undefined, the config will alter the boot status of the Linode. */ booted?: pulumi.Input<boolean>; /** * Optional field for arbitrary User comments on this Config. * * * `devices` - (Optional) A dictionary of device disks to use as a device map in a Linode’s configuration profile. * * * `helpers` - (Optional) Helpers enabled when booting to this Linode Config. * * * `interface` - (Optional) An array of Network Interfaces to use for this Configuration Profile. */ comments?: pulumi.Input<string>; /** * Blocks for device disks in a Linode's configuration profile. */ device?: pulumi.Input<pulumi.Input<inputs.InstanceConfigDevice>[]>; /** * A dictionary of device disks to use as a device map in a Linode's configuration profile. * * @deprecated Devices attribute is deprecated in favor of `device`. */ devices?: pulumi.Input<inputs.InstanceConfigDevices>; /** * Helpers enabled when booting to this Linode Config. */ helpers?: pulumi.Input<pulumi.Input<inputs.InstanceConfigHelper>[]>; /** * An array of Network Interfaces to add to this Linode's Configuration Profile. */ interfaces?: pulumi.Input<pulumi.Input<inputs.InstanceConfigInterface>[]>; /** * A Kernel ID to boot a Linode with. Default is `linode/latest-64bit`. Examples are `linode/latest-64bit`, `linode/grub2`, `linode/direct-disk`, etc. See all kernels [here](https://api.linode.com/v4/linode/kernels). Note that this is a paginated API endpoint ([docs](https://techdocs.akamai.com/linode-api/reference/get-kernels)). */ kernel?: pulumi.Input<string>; /** * The Config’s label for display purposes only. * * - - - */ label?: pulumi.Input<string>; /** * The ID of the Linode to create this configuration profile under. */ linodeId?: pulumi.Input<number>; /** * The memory limit of the Config. Defaults to the total ram of the Linode. */ memoryLimit?: pulumi.Input<number>; /** * The root device to boot. (default `/dev/sda`) */ rootDevice?: pulumi.Input<string>; /** * Defines the state of your Linode after booting. (`default`, `single`, `binbash`) */ runLevel?: pulumi.Input<string>; /** * Controls the virtualization mode. (`paravirt`, `fullvirt`) */ virtMode?: pulumi.Input<string>; } /** * The set of arguments for constructing a InstanceConfig resource. */ export interface InstanceConfigArgs { /** * If true, the Linode will be booted into this config. If another config is booted, the Linode will be rebooted into this config. If false, the Linode will be shutdown only if it is currently booted into this config. If undefined, the config will alter the boot status of the Linode. */ booted?: pulumi.Input<boolean>; /** * Optional field for arbitrary User comments on this Config. * * * `devices` - (Optional) A dictionary of device disks to use as a device map in a Linode’s configuration profile. * * * `helpers` - (Optional) Helpers enabled when booting to this Linode Config. * * * `interface` - (Optional) An array of Network Interfaces to use for this Configuration Profile. */ comments?: pulumi.Input<string>; /** * Blocks for device disks in a Linode's configuration profile. */ device?: pulumi.Input<pulumi.Input<inputs.InstanceConfigDevice>[]>; /** * A dictionary of device disks to use as a device map in a Linode's configuration profile. * * @deprecated Devices attribute is deprecated in favor of `device`. */ devices?: pulumi.Input<inputs.InstanceConfigDevices>; /** * Helpers enabled when booting to this Linode Config. */ helpers?: pulumi.Input<pulumi.Input<inputs.InstanceConfigHelper>[]>; /** * An array of Network Interfaces to add to this Linode's Configuration Profile. */ interfaces?: pulumi.Input<pulumi.Input<inputs.InstanceConfigInterface>[]>; /** * A Kernel ID to boot a Linode with. Default is `linode/latest-64bit`. Examples are `linode/latest-64bit`, `linode/grub2`, `linode/direct-disk`, etc. See all kernels [here](https://api.linode.com/v4/linode/kernels). Note that this is a paginated API endpoint ([docs](https://techdocs.akamai.com/linode-api/reference/get-kernels)). */ kernel?: pulumi.Input<string>; /** * The Config’s label for display purposes only. * * - - - */ label: pulumi.Input<string>; /** * The ID of the Linode to create this configuration profile under. */ linodeId: pulumi.Input<number>; /** * The memory limit of the Config. Defaults to the total ram of the Linode. */ memoryLimit?: pulumi.Input<number>; /** * The root device to boot. (default `/dev/sda`) */ rootDevice?: pulumi.Input<string>; /** * Defines the state of your Linode after booting. (`default`, `single`, `binbash`) */ runLevel?: pulumi.Input<string>; /** * Controls the virtualization mode. (`paravirt`, `fullvirt`) */ virtMode?: pulumi.Input<string>; }