Skip to content

Commit

Permalink
resource/alicloud_disk: add new type for category; datasource/aliclou…
Browse files Browse the repository at this point in the history
…d_disks: add new type for category; resource/alicloud_ecs_disk: add new type for category; datasource/alicloud_ecs_disks: add new type for category, modify valiedation implementation.
  • Loading branch information
ChenHanZhang committed Jan 16, 2024
1 parent ccf73e0 commit 0b3ffab
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions alicloud/data_source_alicloud_ecs_disks.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func dataSourceAlicloudEcsDisks() *schema.Resource {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"cloud", "cloud_efficiency", "cloud_essd", "cloud_ssd", "ephemeral_ssd", "cloud_auto"}, false),
ValidateFunc: StringInSlice([]string{"cloud", "cloud_efficiency", "cloud_essd", "cloud_ssd", "ephemeral_ssd", "cloud_auto", "cloud_essd_entry"}, false),
},
"delete_auto_snapshot": {
Type: schema.TypeBool,
Expand Down Expand Up @@ -71,13 +71,13 @@ func dataSourceAlicloudEcsDisks() *schema.Resource {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"system", "data", "all"}, false),
ValidateFunc: StringInSlice([]string{"system", "data", "all"}, false),
},
"type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"system", "data", "all"}, false),
ValidateFunc: StringInSlice([]string{"system", "data", "all"}, false),
Deprecated: "Field 'type' has been deprecated from provider version 1.122.0. New field 'disk_type' instead.",
},
"dry_run": {
Expand Down Expand Up @@ -105,7 +105,7 @@ func dataSourceAlicloudEcsDisks() *schema.Resource {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"on", "off"}, false),
ValidateFunc: StringInSlice([]string{"on", "off"}, false),
},
"instance_id": {
Type: schema.TypeString,
Expand Down Expand Up @@ -135,7 +135,7 @@ func dataSourceAlicloudEcsDisks() *schema.Resource {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"PayAsYouGo", "Subscription"}, false),
ValidateFunc: StringInSlice([]string{"PayAsYouGo", "Subscription"}, false),
},
"portable": {
Type: schema.TypeBool,
Expand All @@ -156,7 +156,7 @@ func dataSourceAlicloudEcsDisks() *schema.Resource {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{"Attaching", "Available", "Creating", "Detaching", "In_use", "Migrating", "ReIniting", "Transferring"}, false),
ValidateFunc: StringInSlice([]string{"Attaching", "Available", "Creating", "Detaching", "In_use", "Migrating", "ReIniting", "Transferring"}, false),
},
"tags": tagsSchema(),
"zone_id": {
Expand Down
2 changes: 1 addition & 1 deletion alicloud/resource_alicloud_ecs_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func resourceAlicloudEcsDisk() *schema.Resource {
"category": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: StringInSlice([]string{"cloud", "cloud_efficiency", "cloud_essd", "cloud_ssd", "cloud_auto"}, false),
ValidateFunc: StringInSlice([]string{"cloud", "cloud_efficiency", "cloud_essd", "cloud_ssd", "cloud_auto", "cloud_essd_entry"}, false),
Default: "cloud_efficiency",
},
"dedicated_block_storage_cluster_id": {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/disks.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The following arguments are supported:
* `ids` - (Optional) A list of disks IDs.
* `name_regex` - (Optional) A regex string to filter results by disk name.
* `type` - (Optional) Disk type. Possible values: `system` and `data`.
* `category` - (Optional) Disk category. Possible values: `cloud` (basic cloud disk), `cloud_efficiency` (ultra cloud disk), `ephemeral_ssd` (local SSD cloud disk), `cloud_ssd` (SSD cloud disk), and `cloud_essd` (ESSD cloud disk).
* `category` - (Optional) Disk category. Possible values: `cloud` (basic cloud disk), `cloud_efficiency` (ultra cloud disk), `ephemeral_ssd` (local SSD cloud disk), `cloud_ssd` (SSD cloud disk), and `cloud_essd` (ESSD cloud disk), `cloud_essd_entry`.
* `encrypted` - (Optional) Indicate whether the disk is encrypted or not. Possible values: `on` and `off`.
* `instance_id` - (Optional) Filter the results by the specified ECS instance ID.
* `resource_group_id` - (Optional, ForceNew, Available in 1.57.0+) The Id of resource group which the disk belongs.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/ecs_disks.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The following arguments are supported:
* `auto_snapshot_policy_id` - (Optional, ForceNew) Query cloud disks based on the automatic snapshot policy ID.
* `zone_id` - (Optional, ForceNew) ID of the free zone to which the disk belongs.
* `availability_zone` - (Optional, ForceNew, Deprecated in v1.122.0+) Field `availability_zone` has been deprecated from provider version 1.122.0. New field `zone_id` instead.
* `category` - (Optional, ForceNew) Disk category. Valid values: `cloud`, `cloud_efficiency`, `cloud_essd`, `cloud_ssd`, `ephemeral_ssd`, `cloud_auto`.
* `category` - (Optional, ForceNew) Disk category. Valid values: `cloud`, `cloud_efficiency`, `cloud_essd`, `cloud_ssd`, `ephemeral_ssd`, `cloud_auto`, `cloud_essd_entry`.
* `delete_auto_snapshot` - (Optional, ForceNew) Indicates whether the automatic snapshot is deleted when the disk is released.
* `delete_with_instance` - (Optional, ForceNew) Indicates whether the disk is released together with the instance.
* `disk_name` - (Optional, ForceNew) The disk name.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/disk.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The following arguments are supported:
* `availability_zone` - (Required, ForceNew) The Zone to create the disk in.
* `name` - (Optional) Name of the ECS disk. This name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin or end with a hyphen, and must not begin with http:// or https://. Default value is null.
* `description` - (Optional) Description of the disk. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
* `category` - (Optional, ForceNew) Category of the disk. Valid values are `cloud`, `cloud_efficiency`, `cloud_ssd`, `cloud_essd`. Default is `cloud_efficiency`.
* `category` - (Optional, ForceNew) Category of the disk. Valid values are `cloud`, `cloud_efficiency`, `cloud_ssd`, `cloud_essd`, `cloud_essd_entry`. Default is `cloud_efficiency`.
* `size` - (Required) The size of the disk in GiBs. When resize the disk, the new size must be greater than the former value, or you would get an error `InvalidDiskSize.TooSmall`.
* `snapshot_id` - (Optional, ForceNew) A snapshot to base the disk off of. If the disk size required by snapshot is greater than `size`, the `size` will be ignored, conflict with `encrypted`.
* `kms_key_id` - (Optional, Available in 1.89.0+, ForceNew) The ID of the KMS key corresponding to the data disk, The specified parameter `Encrypted` must be `true` when KmsKeyId is not empty.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/ecs_disk.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The following arguments are supported:

* `zone_id` - (Optional, ForceNew) ID of the free zone to which the disk belongs. One of the `zone_id` and `instance_id` must be set but can not be set at the same time.
* `availability_zone` - (Deprecated since 1.122.0) Field `availability_zone` has been deprecated from provider version 1.122.0. New field `zone_id` instead.
* `category` - (Optional) Category of the disk. Valid values are `cloud`, `cloud_efficiency`, `cloud_ssd`, `cloud_essd`, `cloud_auto`. Default is `cloud_efficiency`.
* `category` - (Optional) Category of the disk. Valid values are `cloud`, `cloud_efficiency`, `cloud_ssd`, `cloud_essd`, `cloud_auto`, `cloud_essd_entry`. Default is `cloud_efficiency`.
* `delete_auto_snapshot` - (Optional) Indicates whether the automatic snapshot is deleted when the disk is released. Default value: `false`.
* `delete_with_instance` - (Optional) Indicates whether the disk is released together with the instance. Default value: `false`.
* `description` - (Optional) Description of the disk. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
Expand Down

0 comments on commit 0b3ffab

Please sign in to comment.