@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
393 lines (392 loc) • 13.8 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* Provides a Linode Image resource. This can be used to create, modify, and delete Linodes Images. Linode Images are snapshots of a Linode Instance Disk which can then be used to provision more Linode Instances. Images can be used across regions.
*
* For more information, see [Linode's documentation on Images](https://www.linode.com/docs/platform/disk-images/linode-images/) and the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-image).
*
* ## Example Usage
*
* Creating an image from an existing Linode Instance and deploying another instance with that image:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const foo = new linode.Instance("foo", {
* type: "g6-nanode-1",
* region: "us-central",
* image: "linode/ubuntu22.04",
* rootPass: "insecure-p4ssw0rd!!",
* });
* const bar = new linode.Image("bar", {
* label: "foo-sda-image",
* description: "Image taken from foo",
* diskId: foo.disks.apply(disks => disks[0].id),
* linodeId: foo.id,
* tags: [
* "image-tag",
* "test",
* ],
* });
* const barBased = new linode.Instance("bar_based", {
* type: foo.type,
* region: "eu-west",
* image: bar.id,
* });
* ```
*
* Creating and uploading an image from a local file:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
* import * as std from "@pulumi/std";
*
* const foobar = new linode.Image("foobar", {
* label: "foobar-image",
* description: "An image uploaded from Terraform!",
* region: "us-southeast",
* tags: [
* "image-tag",
* "test",
* ],
* filePath: "path/to/image.img.gz",
* fileHash: std.filemd5({
* input: "path/to/image.img.gz",
* }).then(invoke => invoke.result),
* });
* ```
*
* Upload and replicate an image from a local file:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
* import * as std from "@pulumi/std";
*
* const foobar = new linode.Image("foobar", {
* label: "foobar-image",
* description: "An image uploaded from Terraform!",
* region: "us-southeast",
* tags: [
* "image-tag",
* "test",
* ],
* filePath: "path/to/image.img.gz",
* fileHash: std.filemd5({
* input: "path/to/image.img.gz",
* }).then(invoke => invoke.result),
* replicaRegions: [
* "us-southeast",
* "us-east",
* "eu-west",
* ],
* });
* ```
*
* ## Import
*
* Linodes Images can be imported using the Linode Image `id`, e.g.
*
* ```sh
* $ pulumi import linode:index/image:Image myimage 1234567
* ```
*/
export declare class Image extends pulumi.CustomResource {
/**
* Get an existing Image 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?: ImageState, opts?: pulumi.CustomResourceOptions): Image;
/**
* Returns true if the given object is an instance of Image. 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 Image;
/**
* The capabilities of this Image.
*/
readonly capabilities: pulumi.Output<string[]>;
/**
* Whether this image supports cloud-init.
*/
readonly cloudInit: pulumi.Output<boolean>;
/**
* When this Image was created.
*/
readonly created: pulumi.Output<string>;
/**
* The name of the User who created this Image.
*/
readonly createdBy: pulumi.Output<string>;
/**
* Whether or not this Image is deprecated. Will only be True for deprecated public Images.
*/
readonly deprecated: pulumi.Output<boolean>;
/**
* A detailed description of this Image.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* The ID of the Linode Disk that this Image will be created from.
*/
readonly diskId: pulumi.Output<number | undefined>;
/**
* Only Images created automatically (from a deleted Linode; type=automatic) will expire.
*/
readonly expiry: pulumi.Output<string>;
/**
* The MD5 hash of the file to be uploaded. This is used to trigger file updates.
*/
readonly fileHash: pulumi.Output<string | undefined>;
/**
* The path of the image file to be uploaded.
*/
readonly filePath: pulumi.Output<string | undefined>;
/**
* True if the Image is public.
*/
readonly isPublic: pulumi.Output<boolean>;
/**
* A short description of the Image. Labels cannot contain special characters.
*/
readonly label: pulumi.Output<string>;
/**
* The ID of the Linode that this Image will be created from.
*
* - - -
*
* > **NOTICE:** Uploading images is currently in beta. Ensure `LINODE_API_VERSION` is set to `v4beta` in order to use this functionality.
*
* The following arguments apply to uploading an image:
*/
readonly linodeId: pulumi.Output<number | undefined>;
/**
* The region of the image. See all regions [here](https://techdocs.akamai.com/linode-api/reference/get-regions).
*/
readonly region: pulumi.Output<string | undefined>;
/**
* A list of regions that customer wants to replicate this image in. At least one valid region is required and only core regions allowed. Existing images in the regions not passed will be removed. See Replicate an Image [here](https://techdocs.akamai.com/linode-api/reference/post-replicate-image) for more details.
*/
readonly replicaRegions: pulumi.Output<string[] | undefined>;
/**
* A list of image replications region and corresponding status.
*/
readonly replications: pulumi.Output<outputs.ImageReplication[]>;
/**
* The minimum size this Image needs to deploy. Size is in MB.
*/
readonly size: pulumi.Output<number>;
/**
* The status of an image replica.
*/
readonly status: pulumi.Output<string>;
/**
* A list of customized tags.
*/
readonly tags: pulumi.Output<string[]>;
readonly timeouts: pulumi.Output<outputs.ImageTimeouts | undefined>;
/**
* The total size of the image in all available regions.
*/
readonly totalSize: pulumi.Output<number>;
/**
* How the Image was created. 'Manual' Images can be created at any time. 'Automatic' images are created automatically from a deleted Linode.
*/
readonly type: pulumi.Output<string>;
/**
* The upstream distribution vendor. Nil for private Images.
*/
readonly vendor: pulumi.Output<string>;
/**
* Whether to wait for all image replications become `available`. Default to false.
*
* - - -
*
* The following arguments apply to creating an image from an existing Linode Instance:
*/
readonly waitForReplications: pulumi.Output<boolean>;
/**
* Create a Image 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: ImageArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Image resources.
*/
export interface ImageState {
/**
* The capabilities of this Image.
*/
capabilities?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Whether this image supports cloud-init.
*/
cloudInit?: pulumi.Input<boolean>;
/**
* When this Image was created.
*/
created?: pulumi.Input<string>;
/**
* The name of the User who created this Image.
*/
createdBy?: pulumi.Input<string>;
/**
* Whether or not this Image is deprecated. Will only be True for deprecated public Images.
*/
deprecated?: pulumi.Input<boolean>;
/**
* A detailed description of this Image.
*/
description?: pulumi.Input<string>;
/**
* The ID of the Linode Disk that this Image will be created from.
*/
diskId?: pulumi.Input<number>;
/**
* Only Images created automatically (from a deleted Linode; type=automatic) will expire.
*/
expiry?: pulumi.Input<string>;
/**
* The MD5 hash of the file to be uploaded. This is used to trigger file updates.
*/
fileHash?: pulumi.Input<string>;
/**
* The path of the image file to be uploaded.
*/
filePath?: pulumi.Input<string>;
/**
* True if the Image is public.
*/
isPublic?: pulumi.Input<boolean>;
/**
* A short description of the Image. Labels cannot contain special characters.
*/
label?: pulumi.Input<string>;
/**
* The ID of the Linode that this Image will be created from.
*
* - - -
*
* > **NOTICE:** Uploading images is currently in beta. Ensure `LINODE_API_VERSION` is set to `v4beta` in order to use this functionality.
*
* The following arguments apply to uploading an image:
*/
linodeId?: pulumi.Input<number>;
/**
* The region of the image. See all regions [here](https://techdocs.akamai.com/linode-api/reference/get-regions).
*/
region?: pulumi.Input<string>;
/**
* A list of regions that customer wants to replicate this image in. At least one valid region is required and only core regions allowed. Existing images in the regions not passed will be removed. See Replicate an Image [here](https://techdocs.akamai.com/linode-api/reference/post-replicate-image) for more details.
*/
replicaRegions?: pulumi.Input<pulumi.Input<string>[]>;
/**
* A list of image replications region and corresponding status.
*/
replications?: pulumi.Input<pulumi.Input<inputs.ImageReplication>[]>;
/**
* The minimum size this Image needs to deploy. Size is in MB.
*/
size?: pulumi.Input<number>;
/**
* The status of an image replica.
*/
status?: pulumi.Input<string>;
/**
* A list of customized tags.
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
timeouts?: pulumi.Input<inputs.ImageTimeouts>;
/**
* The total size of the image in all available regions.
*/
totalSize?: pulumi.Input<number>;
/**
* How the Image was created. 'Manual' Images can be created at any time. 'Automatic' images are created automatically from a deleted Linode.
*/
type?: pulumi.Input<string>;
/**
* The upstream distribution vendor. Nil for private Images.
*/
vendor?: pulumi.Input<string>;
/**
* Whether to wait for all image replications become `available`. Default to false.
*
* - - -
*
* The following arguments apply to creating an image from an existing Linode Instance:
*/
waitForReplications?: pulumi.Input<boolean>;
}
/**
* The set of arguments for constructing a Image resource.
*/
export interface ImageArgs {
/**
* Whether this image supports cloud-init.
*/
cloudInit?: pulumi.Input<boolean>;
/**
* A detailed description of this Image.
*/
description?: pulumi.Input<string>;
/**
* The ID of the Linode Disk that this Image will be created from.
*/
diskId?: pulumi.Input<number>;
/**
* The MD5 hash of the file to be uploaded. This is used to trigger file updates.
*/
fileHash?: pulumi.Input<string>;
/**
* The path of the image file to be uploaded.
*/
filePath?: pulumi.Input<string>;
/**
* A short description of the Image. Labels cannot contain special characters.
*/
label: pulumi.Input<string>;
/**
* The ID of the Linode that this Image will be created from.
*
* - - -
*
* > **NOTICE:** Uploading images is currently in beta. Ensure `LINODE_API_VERSION` is set to `v4beta` in order to use this functionality.
*
* The following arguments apply to uploading an image:
*/
linodeId?: pulumi.Input<number>;
/**
* The region of the image. See all regions [here](https://techdocs.akamai.com/linode-api/reference/get-regions).
*/
region?: pulumi.Input<string>;
/**
* A list of regions that customer wants to replicate this image in. At least one valid region is required and only core regions allowed. Existing images in the regions not passed will be removed. See Replicate an Image [here](https://techdocs.akamai.com/linode-api/reference/post-replicate-image) for more details.
*/
replicaRegions?: pulumi.Input<pulumi.Input<string>[]>;
/**
* A list of customized tags.
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
timeouts?: pulumi.Input<inputs.ImageTimeouts>;
/**
* Whether to wait for all image replications become `available`. Default to false.
*
* - - -
*
* The following arguments apply to creating an image from an existing Linode Instance:
*/
waitForReplications?: pulumi.Input<boolean>;
}