@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
666 lines (665 loc) • 26.7 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import { input as inputs, output as outputs } from "../types";
/**
* Manages a volume resource within HuaweiCloud.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const availabilityZone = config.requireObject("availabilityZone");
* const volume = new huaweicloud.evs.Volume("volume", {
* description: "my volume",
* volumeType: "SAS",
* size: 20,
* availabilityZone: availabilityZone,
* tags: {
* foo: "bar",
* key: "value",
* },
* });
* ```
* ### With KMS Encryption
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const availabilityZone = config.requireObject("availabilityZone");
* const volume = new huaweicloud.evs.Volume("volume", {
* description: "my volume",
* volumeType: "SAS",
* size: 20,
* kmsId: _var.kms_id,
* availabilityZone: availabilityZone,
* tags: {
* foo: "bar",
* key: "value",
* },
* });
* ```
* ### With Server_id
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const imageId = config.requireObject("imageId");
* const flavorId = config.requireObject("flavorId");
* const keyPair = config.requireObject("keyPair");
* const securityGroupId = config.requireObject("securityGroupId");
* const availabilityZone = config.requireObject("availabilityZone");
* const subnetId = config.requireObject("subnetId");
* const myinstance = new huaweicloud.ecs.Instance("myinstance", {
* imageId: imageId,
* flavorId: flavorId,
* keyPair: keyPair,
* securityGroupIds: [securityGroupId],
* availabilityZone: availabilityZone,
* networks: [{
* uuid: subnetId,
* }],
* });
* const volume = new huaweicloud.evs.Volume("volume", {
* description: "my volume",
* volumeType: "SAS",
* size: 20,
* availabilityZone: availabilityZone,
* serverId: myinstance.id,
* tags: {
* foo: "bar",
* key: "value",
* },
* });
* ```
*
* ## Import
*
* Volumes can be imported using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Evs/volume:Volume test <id>
* ```
*
* Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`cascade`, `period_unit`, `period`, `server_id`, `auto_renew`, and `charging_mode`. It is generally recommended running terraform plan after importing a disk. You can then decide if changes should be applied to the disk, or the resource definition should be updated to align with the disk. Also, you can ignore changes as below. hcl resource "huaweicloud_evs_volume" "test" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* cascade, period_unit, period, server_id, auto_renew, charging_mode,
*
* ]
*
* } }
*/
export declare class Volume extends pulumi.CustomResource {
/**
* Get an existing Volume 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?: VolumeState, opts?: pulumi.CustomResourceOptions): Volume;
/**
* Returns true if the given object is an instance of Volume. 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 Volume;
/**
* The key-value pair disk metadata. Valid key-value pairs are as follows:
* + **__system__cmkid**: The encryption CMK ID in metadata. This attribute is used together with **__system__encrypted**
* for encryption.
* + **__system__encrypted**: The encryption field in metadata. The value can be `0` (no encryption) or `1` (encryption).
* If this attribute is not specified, the encryption attribute of the disk is the same as that of the data source.
* If the disk is not created from a data source, the disk is not encrypted by default.
* + **full_clone**: The creation method when the disk is created from a snapshot. `0`: linked clone. `1`: full clone.
* + **hw:passthrough**: If this attribute value is **true**, the disk device type is SCSI, which allows ECS OSs to directly
* access the underlying storage media and supports SCSI reservation commands. If this attribute is set to **false**,
* the disk device type is VBD, which is also the default type. VBD supports only simple SCSI read/write commands.
* If this attribute is not specified, the disk device type is VBD.
* + **orderID**: The attribute that describes the disk billing mode in metadata. If this attribute has a value, the disk
* is billed on a yearly/monthly basis. If this attribute is empty, the disk is billed on a pay-per-use basis.
*/
readonly allMetadata: pulumi.Output<{
[key: string]: string;
}>;
/**
* The metadata of the disk image.
*/
readonly allVolumeImageMetadata: pulumi.Output<{
[key: string]: string;
}>;
/**
* If a disk is attached to an instance, this attribute will display the attachment ID, instance ID, and
* the device as the instance sees it. The attachment structure is documented below.
*/
readonly attachments: pulumi.Output<outputs.Evs.VolumeAttachment[]>;
/**
* @deprecated Deprecated
*/
readonly autoPay: pulumi.Output<string | undefined>;
/**
* Specifies whether auto-renew is enabled.
* Valid values are **true** and **false**. Defaults to **false**.
*/
readonly autoRenew: pulumi.Output<string | undefined>;
/**
* Specifies the availability zone for the disk.
*/
readonly availabilityZone: pulumi.Output<string>;
/**
* Specifies the backup ID from which to create the disk.
*/
readonly backupId: pulumi.Output<string | undefined>;
/**
* Whether the disk is bootable. **true**: The disk is bootable. **false**: The disk is not bootable.
*/
readonly bootable: pulumi.Output<string>;
/**
* Specifies the delete mode of snapshot. The default value is **false**. All snapshot
* associated with the disk will also be deleted when the parameter is set to **true**.
*/
readonly cascade: pulumi.Output<boolean | undefined>;
/**
* Specifies the charging mode of the disk.
* The valid values are as follows:
* + **prePaid**: the yearly/monthly billing mode.
* + **postPaid**: the pay-per-use billing mode.
*/
readonly chargingMode: pulumi.Output<string>;
/**
* The time when the disk was created.
*/
readonly createdAt: pulumi.Output<string>;
/**
* Specifies the ID of the DSS storage pool accommodating the disk.
*/
readonly dedicatedStorageId: pulumi.Output<string | undefined>;
/**
* The name of the DSS storage pool accommodating the disk.
*/
readonly dedicatedStorageName: pulumi.Output<string>;
/**
* Specifies the disk description. You can enter up to `85` characters.
*/
readonly description: pulumi.Output<string | undefined>;
/**
* Specifies the device type of disk to create. Valid options are **VBD** and
* **SCSI**. Defaults to **VBD**.
*/
readonly deviceType: pulumi.Output<string | undefined>;
/**
* Specifies the enterprise project ID of the disk.
* For enterprise users, if omitted, default enterprise project will be used.
*/
readonly enterpriseProjectId: pulumi.Output<string>;
/**
* Specifies the image ID from which to create the disk.
*/
readonly imageId: pulumi.Output<string | undefined>;
/**
* Specifies the IOPS(Input/Output Operations Per Second) for the volume.
* The field is valid and required when `volumeType` is set to **GPSSD2** or **ESSD2**.
* This field can be changed only when the disk status is Available or In-use.
*/
readonly iops: pulumi.Output<number>;
/**
* The disk IOPS information. This attribute appears only for a general purpose SSD V2 or an extreme
* SSD V2 disk. The iopsAttribute structure is documented below.
*/
readonly iopsAttributes: pulumi.Output<outputs.Evs.VolumeIopsAttribute[]>;
/**
* Specifies the Encryption KMS ID to create the disk.
*/
readonly kmsId: pulumi.Output<string | undefined>;
/**
* The disk URI.
* The links structure is documented below.
*/
readonly links: pulumi.Output<outputs.Evs.VolumeLink[]>;
/**
* Specifies whether the disk is shareable. Defaults to **false**.
*/
readonly multiattach: pulumi.Output<boolean | undefined>;
/**
* Specifies the disk name. You can enter up to `64` characters.
*/
readonly name: pulumi.Output<string>;
/**
* Specifies the charging period of the disk.
* + If `periodUnit` is set to **month**, the value ranges from `1` to `9`.
* + If `periodUnit` is set to **year**, the valid value is `1`.
*/
readonly period: pulumi.Output<number | undefined>;
/**
* Specifies the charging period unit of the disk.
* Valid values are **month** and **year**. This parameter is mandatory if `chargingMode` is set to **prePaid**.
*/
readonly periodUnit: pulumi.Output<string | undefined>;
/**
* Specifies the region in which to create the disk. If omitted, the
* provider-level region will be used. Changing this parameter will create a new resource.
*/
readonly region: pulumi.Output<string>;
/**
* The disk serial number. This field is returned only for non-HyperMetro SCSI disks and is used for
* disk mapping in the VM.
*/
readonly serialNumber: pulumi.Output<string>;
/**
* Specifies the server ID to which the cloud volume is to be mounted.
* After specifying the value of this field, the cloud volume will be automatically attached on the cloud server.
* The chargingMode of the created cloud volume will be consistent with that of the cloud server.
* Currently, only ECS cloud-servers are supported, and BMS bare metal cloud-servers are not supported yet.
*/
readonly serverId: pulumi.Output<string | undefined>;
/**
* The service type. Supported services are **EVS**, **DSS**, and **DESS**.
*/
readonly serviceType: pulumi.Output<string>;
/**
* Specifies the disk size, in GB.
* For system disk, the valid value ranges from `1` GB to `1,024` GB.
* For data disk, the valid value ranges from `10` GB to `32,768` GB.
*/
readonly size: pulumi.Output<number>;
/**
* Specifies the snapshot ID from which to create the disk.
*/
readonly snapshotId: pulumi.Output<string | undefined>;
/**
* The disk status.
* Please refer to [EVS Disk Status](https://support.huaweicloud.com/intl/en-us/api-evs/evs_04_0040.html).
*/
readonly status: pulumi.Output<string>;
/**
* Specifies the key/value pairs to associate with the disk.
*/
readonly tags: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* Specifies the throughput for the volume. The Unit is MiB/s.
* The field is valid and required when `volumeType` is set to **GPSSD2**.
* This field can be changed only when the disk status is Available or In-use.
*/
readonly throughput: pulumi.Output<number>;
/**
* The disk throughput information. This attribute appears only for a general purpose SSD V2 disk.
* The throughputAttribute structure is documented below.
*/
readonly throughputAttributes: pulumi.Output<outputs.Evs.VolumeThroughputAttribute[]>;
/**
* The time when the disk was updated.
*/
readonly updatedAt: pulumi.Output<string>;
/**
* Specifies the disk type. Valid values are as follows:
* + **SAS**: High I/O type.
* + **SSD**: Ultra-high I/O type.
* + **GPSSD**: General purpose SSD type.
* + **ESSD**: Extreme SSD type.
* + **GPSSD2**: General purpose SSD V2 type.
* + **ESSD2**: Extreme SSD V2 type.
*/
readonly volumeType: pulumi.Output<string>;
/**
* The unique identifier used for mounting the EVS disk.
*/
readonly wwn: pulumi.Output<string>;
/**
* Create a Volume 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: VolumeArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Volume resources.
*/
export interface VolumeState {
/**
* The key-value pair disk metadata. Valid key-value pairs are as follows:
* + **__system__cmkid**: The encryption CMK ID in metadata. This attribute is used together with **__system__encrypted**
* for encryption.
* + **__system__encrypted**: The encryption field in metadata. The value can be `0` (no encryption) or `1` (encryption).
* If this attribute is not specified, the encryption attribute of the disk is the same as that of the data source.
* If the disk is not created from a data source, the disk is not encrypted by default.
* + **full_clone**: The creation method when the disk is created from a snapshot. `0`: linked clone. `1`: full clone.
* + **hw:passthrough**: If this attribute value is **true**, the disk device type is SCSI, which allows ECS OSs to directly
* access the underlying storage media and supports SCSI reservation commands. If this attribute is set to **false**,
* the disk device type is VBD, which is also the default type. VBD supports only simple SCSI read/write commands.
* If this attribute is not specified, the disk device type is VBD.
* + **orderID**: The attribute that describes the disk billing mode in metadata. If this attribute has a value, the disk
* is billed on a yearly/monthly basis. If this attribute is empty, the disk is billed on a pay-per-use basis.
*/
allMetadata?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* The metadata of the disk image.
*/
allVolumeImageMetadata?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* If a disk is attached to an instance, this attribute will display the attachment ID, instance ID, and
* the device as the instance sees it. The attachment structure is documented below.
*/
attachments?: pulumi.Input<pulumi.Input<inputs.Evs.VolumeAttachment>[]>;
/**
* @deprecated Deprecated
*/
autoPay?: pulumi.Input<string>;
/**
* Specifies whether auto-renew is enabled.
* Valid values are **true** and **false**. Defaults to **false**.
*/
autoRenew?: pulumi.Input<string>;
/**
* Specifies the availability zone for the disk.
*/
availabilityZone?: pulumi.Input<string>;
/**
* Specifies the backup ID from which to create the disk.
*/
backupId?: pulumi.Input<string>;
/**
* Whether the disk is bootable. **true**: The disk is bootable. **false**: The disk is not bootable.
*/
bootable?: pulumi.Input<string>;
/**
* Specifies the delete mode of snapshot. The default value is **false**. All snapshot
* associated with the disk will also be deleted when the parameter is set to **true**.
*/
cascade?: pulumi.Input<boolean>;
/**
* Specifies the charging mode of the disk.
* The valid values are as follows:
* + **prePaid**: the yearly/monthly billing mode.
* + **postPaid**: the pay-per-use billing mode.
*/
chargingMode?: pulumi.Input<string>;
/**
* The time when the disk was created.
*/
createdAt?: pulumi.Input<string>;
/**
* Specifies the ID of the DSS storage pool accommodating the disk.
*/
dedicatedStorageId?: pulumi.Input<string>;
/**
* The name of the DSS storage pool accommodating the disk.
*/
dedicatedStorageName?: pulumi.Input<string>;
/**
* Specifies the disk description. You can enter up to `85` characters.
*/
description?: pulumi.Input<string>;
/**
* Specifies the device type of disk to create. Valid options are **VBD** and
* **SCSI**. Defaults to **VBD**.
*/
deviceType?: pulumi.Input<string>;
/**
* Specifies the enterprise project ID of the disk.
* For enterprise users, if omitted, default enterprise project will be used.
*/
enterpriseProjectId?: pulumi.Input<string>;
/**
* Specifies the image ID from which to create the disk.
*/
imageId?: pulumi.Input<string>;
/**
* Specifies the IOPS(Input/Output Operations Per Second) for the volume.
* The field is valid and required when `volumeType` is set to **GPSSD2** or **ESSD2**.
* This field can be changed only when the disk status is Available or In-use.
*/
iops?: pulumi.Input<number>;
/**
* The disk IOPS information. This attribute appears only for a general purpose SSD V2 or an extreme
* SSD V2 disk. The iopsAttribute structure is documented below.
*/
iopsAttributes?: pulumi.Input<pulumi.Input<inputs.Evs.VolumeIopsAttribute>[]>;
/**
* Specifies the Encryption KMS ID to create the disk.
*/
kmsId?: pulumi.Input<string>;
/**
* The disk URI.
* The links structure is documented below.
*/
links?: pulumi.Input<pulumi.Input<inputs.Evs.VolumeLink>[]>;
/**
* Specifies whether the disk is shareable. Defaults to **false**.
*/
multiattach?: pulumi.Input<boolean>;
/**
* Specifies the disk name. You can enter up to `64` characters.
*/
name?: pulumi.Input<string>;
/**
* Specifies the charging period of the disk.
* + If `periodUnit` is set to **month**, the value ranges from `1` to `9`.
* + If `periodUnit` is set to **year**, the valid value is `1`.
*/
period?: pulumi.Input<number>;
/**
* Specifies the charging period unit of the disk.
* Valid values are **month** and **year**. This parameter is mandatory if `chargingMode` is set to **prePaid**.
*/
periodUnit?: pulumi.Input<string>;
/**
* Specifies the region in which to create the disk. If omitted, the
* provider-level region will be used. Changing this parameter will create a new resource.
*/
region?: pulumi.Input<string>;
/**
* The disk serial number. This field is returned only for non-HyperMetro SCSI disks and is used for
* disk mapping in the VM.
*/
serialNumber?: pulumi.Input<string>;
/**
* Specifies the server ID to which the cloud volume is to be mounted.
* After specifying the value of this field, the cloud volume will be automatically attached on the cloud server.
* The chargingMode of the created cloud volume will be consistent with that of the cloud server.
* Currently, only ECS cloud-servers are supported, and BMS bare metal cloud-servers are not supported yet.
*/
serverId?: pulumi.Input<string>;
/**
* The service type. Supported services are **EVS**, **DSS**, and **DESS**.
*/
serviceType?: pulumi.Input<string>;
/**
* Specifies the disk size, in GB.
* For system disk, the valid value ranges from `1` GB to `1,024` GB.
* For data disk, the valid value ranges from `10` GB to `32,768` GB.
*/
size?: pulumi.Input<number>;
/**
* Specifies the snapshot ID from which to create the disk.
*/
snapshotId?: pulumi.Input<string>;
/**
* The disk status.
* Please refer to [EVS Disk Status](https://support.huaweicloud.com/intl/en-us/api-evs/evs_04_0040.html).
*/
status?: pulumi.Input<string>;
/**
* Specifies the key/value pairs to associate with the disk.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Specifies the throughput for the volume. The Unit is MiB/s.
* The field is valid and required when `volumeType` is set to **GPSSD2**.
* This field can be changed only when the disk status is Available or In-use.
*/
throughput?: pulumi.Input<number>;
/**
* The disk throughput information. This attribute appears only for a general purpose SSD V2 disk.
* The throughputAttribute structure is documented below.
*/
throughputAttributes?: pulumi.Input<pulumi.Input<inputs.Evs.VolumeThroughputAttribute>[]>;
/**
* The time when the disk was updated.
*/
updatedAt?: pulumi.Input<string>;
/**
* Specifies the disk type. Valid values are as follows:
* + **SAS**: High I/O type.
* + **SSD**: Ultra-high I/O type.
* + **GPSSD**: General purpose SSD type.
* + **ESSD**: Extreme SSD type.
* + **GPSSD2**: General purpose SSD V2 type.
* + **ESSD2**: Extreme SSD V2 type.
*/
volumeType?: pulumi.Input<string>;
/**
* The unique identifier used for mounting the EVS disk.
*/
wwn?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a Volume resource.
*/
export interface VolumeArgs {
/**
* @deprecated Deprecated
*/
autoPay?: pulumi.Input<string>;
/**
* Specifies whether auto-renew is enabled.
* Valid values are **true** and **false**. Defaults to **false**.
*/
autoRenew?: pulumi.Input<string>;
/**
* Specifies the availability zone for the disk.
*/
availabilityZone: pulumi.Input<string>;
/**
* Specifies the backup ID from which to create the disk.
*/
backupId?: pulumi.Input<string>;
/**
* Specifies the delete mode of snapshot. The default value is **false**. All snapshot
* associated with the disk will also be deleted when the parameter is set to **true**.
*/
cascade?: pulumi.Input<boolean>;
/**
* Specifies the charging mode of the disk.
* The valid values are as follows:
* + **prePaid**: the yearly/monthly billing mode.
* + **postPaid**: the pay-per-use billing mode.
*/
chargingMode?: pulumi.Input<string>;
/**
* Specifies the ID of the DSS storage pool accommodating the disk.
*/
dedicatedStorageId?: pulumi.Input<string>;
/**
* Specifies the disk description. You can enter up to `85` characters.
*/
description?: pulumi.Input<string>;
/**
* Specifies the device type of disk to create. Valid options are **VBD** and
* **SCSI**. Defaults to **VBD**.
*/
deviceType?: pulumi.Input<string>;
/**
* Specifies the enterprise project ID of the disk.
* For enterprise users, if omitted, default enterprise project will be used.
*/
enterpriseProjectId?: pulumi.Input<string>;
/**
* Specifies the image ID from which to create the disk.
*/
imageId?: pulumi.Input<string>;
/**
* Specifies the IOPS(Input/Output Operations Per Second) for the volume.
* The field is valid and required when `volumeType` is set to **GPSSD2** or **ESSD2**.
* This field can be changed only when the disk status is Available or In-use.
*/
iops?: pulumi.Input<number>;
/**
* Specifies the Encryption KMS ID to create the disk.
*/
kmsId?: pulumi.Input<string>;
/**
* Specifies whether the disk is shareable. Defaults to **false**.
*/
multiattach?: pulumi.Input<boolean>;
/**
* Specifies the disk name. You can enter up to `64` characters.
*/
name?: pulumi.Input<string>;
/**
* Specifies the charging period of the disk.
* + If `periodUnit` is set to **month**, the value ranges from `1` to `9`.
* + If `periodUnit` is set to **year**, the valid value is `1`.
*/
period?: pulumi.Input<number>;
/**
* Specifies the charging period unit of the disk.
* Valid values are **month** and **year**. This parameter is mandatory if `chargingMode` is set to **prePaid**.
*/
periodUnit?: pulumi.Input<string>;
/**
* Specifies the region in which to create the disk. If omitted, the
* provider-level region will be used. Changing this parameter will create a new resource.
*/
region?: pulumi.Input<string>;
/**
* Specifies the server ID to which the cloud volume is to be mounted.
* After specifying the value of this field, the cloud volume will be automatically attached on the cloud server.
* The chargingMode of the created cloud volume will be consistent with that of the cloud server.
* Currently, only ECS cloud-servers are supported, and BMS bare metal cloud-servers are not supported yet.
*/
serverId?: pulumi.Input<string>;
/**
* Specifies the disk size, in GB.
* For system disk, the valid value ranges from `1` GB to `1,024` GB.
* For data disk, the valid value ranges from `10` GB to `32,768` GB.
*/
size?: pulumi.Input<number>;
/**
* Specifies the snapshot ID from which to create the disk.
*/
snapshotId?: pulumi.Input<string>;
/**
* Specifies the key/value pairs to associate with the disk.
*/
tags?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Specifies the throughput for the volume. The Unit is MiB/s.
* The field is valid and required when `volumeType` is set to **GPSSD2**.
* This field can be changed only when the disk status is Available or In-use.
*/
throughput?: pulumi.Input<number>;
/**
* Specifies the disk type. Valid values are as follows:
* + **SAS**: High I/O type.
* + **SSD**: Ultra-high I/O type.
* + **GPSSD**: General purpose SSD type.
* + **ESSD**: Extreme SSD type.
* + **GPSSD2**: General purpose SSD V2 type.
* + **ESSD2**: Extreme SSD V2 type.
*/
volumeType: pulumi.Input<string>;
}