Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AS] Fix issue with disk size validation #1084

Merged
merged 5 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/resources/as_configuration_v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ The `instance_config` block supports:

The `disk` block supports:

* `size` - (Required) The disk size. The unit is GB. The system disk size ranges from 40 to 32768,
and the data disk size ranges from 10 to 32768.
* `size` - (Required) The disk size. The unit is GB. The system disk size ranges from `4` to `32768` and must
be greater than or equal to the minimum size (`min_disk` value) of the system disk specified in the image.
The data disk size ranges from `10` to `32768`.

* `volume_type` - (Required) Specifies the ECS system disk type. The disk type must match the available disk type.
* `SATA`: common I/O disk type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ resource "opentelekomcloud_as_configuration_v1" "as_config"{
instance_config {
image = "%s"
disk {
size = 10
size = 1
volume_type = "uh-l1"
disk_type = "SYS"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ func validateDiskSize(d *schema.ResourceDiff, _ interface{}) error {
size := disk["size"].(int)
diskType := disk["disk_type"].(string)
if diskType == "SYS" {
if size < 40 || size > 32768 {
mErr = multierror.Append(mErr, fmt.Errorf("for system disk size should be [40, 32768]"))
if size < 4 || size > 32768 {
mErr = multierror.Append(mErr, fmt.Errorf("for system disk size should be [4, 32768]"))
}
}
if diskType == "DATA" {
Expand Down