UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

477 lines (476 loc) 20.3 kB
import * as pulumi from "@pulumi/pulumi"; /** * !> **WARNING:** It has been deprecated, please select the corresponding resource replacement based on the image type and * creation method, please use resources named in `huaweicloudImsXxxXxxImage` format instead. * * Manages an IMS image resource within HuaweiCloud. * * ## Example Usage * ### Creating a system image from an existing ECS instance * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const name = config.requireObject("name"); * const instanceId = config.requireObject("instanceId"); * const test = new huaweicloud.ims.Image("test", { * instanceId: instanceId, * tags: { * foo: "bar", * key: "value", * }, * }); * ``` * ### Creating a system image from OBS bucket * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const name = config.requireObject("name"); * const imageUrl = config.requireObject("imageUrl"); * const minDisk = config.requireObject("minDisk"); * const test = new huaweicloud.ims.Image("test", { * imageUrl: imageUrl, * minDisk: minDisk, * }); * ``` * ### Creating a whole image from an existing ECS instance * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const name = config.requireObject("name"); * const instanceId = config.requireObject("instanceId"); * const vaultId = config.requireObject("vaultId"); * const test = new huaweicloud.ims.Image("test", { * instanceId: instanceId, * vaultId: vaultId, * }); * ``` * ### Creating a whole image from CBR backup * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const name = config.requireObject("name"); * const backupId = config.requireObject("backupId"); * const test = new huaweicloud.ims.Image("test", {backupId: backupId}); * ``` * ### Creating a data image from the data disk bound to the ECS instance * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const name = config.requireObject("name"); * const volumeId = config.requireObject("volumeId"); * const test = new huaweicloud.ims.Image("test", {volumeId: volumeId}); * ``` * * ## Import * * Image can be imported using the `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:Ims/image:Image test <id> * ``` * * Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response. The missing attributes include`vault_id`. It is generally recommended running `terraform plan` after importing the image. You can then decide if changes should be applied to the image, or the resource definition should be updated to align with the image. Also, you can ignore changes as below. hcl resource "huaweicloud_images_image" "test" { * * ... * * lifecycle { * * ignore_changes = [ * * vault_id, * * ] * * } } */ 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; /** * Specifies the ID of the CBR backup that needs to be converted into an * image. This parameter is valid and mandatory only when you create a private whole image from a CBR backup. * Changing this parameter will create a new resource. */ readonly backupId: pulumi.Output<string>; /** * The checksum of the data associated with the image. */ readonly checksum: pulumi.Output<string>; /** * Specifies the master key used for encrypting an image. * Changing this parameter will create a new resource. */ readonly cmkId: pulumi.Output<string | undefined>; /** * The image resource. The pattern can be **server_backup,backup_id**, **instance,instance_id**, * **file,image_url**, or **volume,volume_id**. */ readonly dataOrigin: pulumi.Output<string>; /** * Specifies the description of the image. */ readonly description: pulumi.Output<string | undefined>; /** * The image file format. The value can be **vhd**, **zvhd**, **raw**, **zvhd2**, or **qcow2**. */ readonly diskFormat: pulumi.Output<string>; /** * Specifies the enterprise project ID to which the IMS image * belongs. For enterprise users, if omitted, default enterprise project will be used. * Changing this parameter will create a new resource. */ readonly enterpriseProjectId: pulumi.Output<string>; /** * The size(bytes) of the image file format. */ readonly imageSize: pulumi.Output<string>; /** * Specifies the URL of the external image file in the OBS bucket, the format * is **OBS bucket name:Image file name**, e.g. **obs_bucket_name:image_test.vhd**. The storage category for OBS bucket * and image file must be OBS standard storage. This parameter is valid and mandatory when you create a private system * image from an external file uploaded to an OBS bucket, and this parameter can only be used with `minDisk`. * Changing this parameter will create a new resource. */ readonly imageUrl: pulumi.Output<string | undefined>; /** * Specifies the ID of the ECS that needs to be converted into an image. * This parameter is valid and mandatory only when you create a private system image or a private whole image from an * ECS instance. Changing this parameter will create a new resource. * + If the value of `vaultId` is empty, then a private system image will be created. * + If the value of `vaultId` is not empty, then a private whole image will be created. */ readonly instanceId: pulumi.Output<string>; /** * Specifies whether to automatically configure. If automatic backend * configuration is required, set the value to **true**, Otherwise, set it to **false**. The default value is **false**. * Changing this parameter will create a new resource. */ readonly isConfig: pulumi.Output<boolean | undefined>; /** * Specifies the maximum memory of the image in the unit of MB. */ readonly maxRam: pulumi.Output<number>; /** * Specifies the minimum size of the system disk in the unit of GB. This parameter * is valid and mandatory when you create a private system image from an external file uploaded to an OBS bucket. * Changing this parameter will create a new resource. * + When the operating system is Linux, the value ranges from `10` to `1,024`. * + When the operating system is Windows, the value ranges from `20` to `1,024`. */ readonly minDisk: pulumi.Output<number | undefined>; /** * Specifies the minimum memory of the image in the unit of MB. The default value is `0`, * indicating that the memory is not restricted. */ readonly minRam: pulumi.Output<number>; /** * Specifies the name of the image. */ readonly name: pulumi.Output<string>; /** * Specifies the OS version. * Changing this parameter will create a new resource. * For its values, see [API docs](https://support.huaweicloud.com/intl/en-us/api-ims/ims_03_0910.html). */ readonly osVersion: pulumi.Output<string>; /** * Specifies the region in which to create the resource. * If omitted, the provider-level region will be used. Changing this parameter will create a new resource. */ readonly region: pulumi.Output<string>; /** * The status of the image. */ readonly status: pulumi.Output<string>; /** * Specifies the key/value pairs to associate with the image. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Specifies the image type. The value can be **ECS**, **FusionCompute**, **BMS**, * or **Ironic**. Changing this parameter will create a new resource. */ readonly type: pulumi.Output<string | undefined>; /** * Specifies the ID of the vault to which an ECS instance is to be added or has * been added. This parameter can only be used with `instanceId`. Changing this parameter will create a new resource. */ readonly vaultId: pulumi.Output<string | undefined>; /** * Whether the image is visible to other tenants. */ readonly visibility: pulumi.Output<string>; /** * Specifies the ID of the data disk. This parameter is valid and mandatory * when you create a private data image from an ECS instance, and the data disk must be bound to the ECS instance. * Changing this parameter will create a new resource. */ readonly volumeId: pulumi.Output<string>; /** * 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 { /** * Specifies the ID of the CBR backup that needs to be converted into an * image. This parameter is valid and mandatory only when you create a private whole image from a CBR backup. * Changing this parameter will create a new resource. */ backupId?: pulumi.Input<string>; /** * The checksum of the data associated with the image. */ checksum?: pulumi.Input<string>; /** * Specifies the master key used for encrypting an image. * Changing this parameter will create a new resource. */ cmkId?: pulumi.Input<string>; /** * The image resource. The pattern can be **server_backup,backup_id**, **instance,instance_id**, * **file,image_url**, or **volume,volume_id**. */ dataOrigin?: pulumi.Input<string>; /** * Specifies the description of the image. */ description?: pulumi.Input<string>; /** * The image file format. The value can be **vhd**, **zvhd**, **raw**, **zvhd2**, or **qcow2**. */ diskFormat?: pulumi.Input<string>; /** * Specifies the enterprise project ID to which the IMS image * belongs. For enterprise users, if omitted, default enterprise project will be used. * Changing this parameter will create a new resource. */ enterpriseProjectId?: pulumi.Input<string>; /** * The size(bytes) of the image file format. */ imageSize?: pulumi.Input<string>; /** * Specifies the URL of the external image file in the OBS bucket, the format * is **OBS bucket name:Image file name**, e.g. **obs_bucket_name:image_test.vhd**. The storage category for OBS bucket * and image file must be OBS standard storage. This parameter is valid and mandatory when you create a private system * image from an external file uploaded to an OBS bucket, and this parameter can only be used with `minDisk`. * Changing this parameter will create a new resource. */ imageUrl?: pulumi.Input<string>; /** * Specifies the ID of the ECS that needs to be converted into an image. * This parameter is valid and mandatory only when you create a private system image or a private whole image from an * ECS instance. Changing this parameter will create a new resource. * + If the value of `vaultId` is empty, then a private system image will be created. * + If the value of `vaultId` is not empty, then a private whole image will be created. */ instanceId?: pulumi.Input<string>; /** * Specifies whether to automatically configure. If automatic backend * configuration is required, set the value to **true**, Otherwise, set it to **false**. The default value is **false**. * Changing this parameter will create a new resource. */ isConfig?: pulumi.Input<boolean>; /** * Specifies the maximum memory of the image in the unit of MB. */ maxRam?: pulumi.Input<number>; /** * Specifies the minimum size of the system disk in the unit of GB. This parameter * is valid and mandatory when you create a private system image from an external file uploaded to an OBS bucket. * Changing this parameter will create a new resource. * + When the operating system is Linux, the value ranges from `10` to `1,024`. * + When the operating system is Windows, the value ranges from `20` to `1,024`. */ minDisk?: pulumi.Input<number>; /** * Specifies the minimum memory of the image in the unit of MB. The default value is `0`, * indicating that the memory is not restricted. */ minRam?: pulumi.Input<number>; /** * Specifies the name of the image. */ name?: pulumi.Input<string>; /** * Specifies the OS version. * Changing this parameter will create a new resource. * For its values, see [API docs](https://support.huaweicloud.com/intl/en-us/api-ims/ims_03_0910.html). */ osVersion?: pulumi.Input<string>; /** * Specifies the region in which to create the resource. * If omitted, the provider-level region will be used. Changing this parameter will create a new resource. */ region?: pulumi.Input<string>; /** * The status of the image. */ status?: pulumi.Input<string>; /** * Specifies the key/value pairs to associate with the image. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Specifies the image type. The value can be **ECS**, **FusionCompute**, **BMS**, * or **Ironic**. Changing this parameter will create a new resource. */ type?: pulumi.Input<string>; /** * Specifies the ID of the vault to which an ECS instance is to be added or has * been added. This parameter can only be used with `instanceId`. Changing this parameter will create a new resource. */ vaultId?: pulumi.Input<string>; /** * Whether the image is visible to other tenants. */ visibility?: pulumi.Input<string>; /** * Specifies the ID of the data disk. This parameter is valid and mandatory * when you create a private data image from an ECS instance, and the data disk must be bound to the ECS instance. * Changing this parameter will create a new resource. */ volumeId?: pulumi.Input<string>; } /** * The set of arguments for constructing a Image resource. */ export interface ImageArgs { /** * Specifies the ID of the CBR backup that needs to be converted into an * image. This parameter is valid and mandatory only when you create a private whole image from a CBR backup. * Changing this parameter will create a new resource. */ backupId?: pulumi.Input<string>; /** * Specifies the master key used for encrypting an image. * Changing this parameter will create a new resource. */ cmkId?: pulumi.Input<string>; /** * Specifies the description of the image. */ description?: pulumi.Input<string>; /** * Specifies the enterprise project ID to which the IMS image * belongs. For enterprise users, if omitted, default enterprise project will be used. * Changing this parameter will create a new resource. */ enterpriseProjectId?: pulumi.Input<string>; /** * Specifies the URL of the external image file in the OBS bucket, the format * is **OBS bucket name:Image file name**, e.g. **obs_bucket_name:image_test.vhd**. The storage category for OBS bucket * and image file must be OBS standard storage. This parameter is valid and mandatory when you create a private system * image from an external file uploaded to an OBS bucket, and this parameter can only be used with `minDisk`. * Changing this parameter will create a new resource. */ imageUrl?: pulumi.Input<string>; /** * Specifies the ID of the ECS that needs to be converted into an image. * This parameter is valid and mandatory only when you create a private system image or a private whole image from an * ECS instance. Changing this parameter will create a new resource. * + If the value of `vaultId` is empty, then a private system image will be created. * + If the value of `vaultId` is not empty, then a private whole image will be created. */ instanceId?: pulumi.Input<string>; /** * Specifies whether to automatically configure. If automatic backend * configuration is required, set the value to **true**, Otherwise, set it to **false**. The default value is **false**. * Changing this parameter will create a new resource. */ isConfig?: pulumi.Input<boolean>; /** * Specifies the maximum memory of the image in the unit of MB. */ maxRam?: pulumi.Input<number>; /** * Specifies the minimum size of the system disk in the unit of GB. This parameter * is valid and mandatory when you create a private system image from an external file uploaded to an OBS bucket. * Changing this parameter will create a new resource. * + When the operating system is Linux, the value ranges from `10` to `1,024`. * + When the operating system is Windows, the value ranges from `20` to `1,024`. */ minDisk?: pulumi.Input<number>; /** * Specifies the minimum memory of the image in the unit of MB. The default value is `0`, * indicating that the memory is not restricted. */ minRam?: pulumi.Input<number>; /** * Specifies the name of the image. */ name?: pulumi.Input<string>; /** * Specifies the OS version. * Changing this parameter will create a new resource. * For its values, see [API docs](https://support.huaweicloud.com/intl/en-us/api-ims/ims_03_0910.html). */ osVersion?: pulumi.Input<string>; /** * Specifies the region in which to create the resource. * If omitted, the provider-level region will be used. Changing this parameter will create a new resource. */ region?: pulumi.Input<string>; /** * Specifies the key/value pairs to associate with the image. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Specifies the image type. The value can be **ECS**, **FusionCompute**, **BMS**, * or **Ironic**. Changing this parameter will create a new resource. */ type?: pulumi.Input<string>; /** * Specifies the ID of the vault to which an ECS instance is to be added or has * been added. This parameter can only be used with `instanceId`. Changing this parameter will create a new resource. */ vaultId?: pulumi.Input<string>; /** * Specifies the ID of the data disk. This parameter is valid and mandatory * when you create a private data image from an ECS instance, and the data disk must be bound to the ECS instance. * Changing this parameter will create a new resource. */ volumeId?: pulumi.Input<string>; }