diff --git a/docs/data-sources/compute_flavors.md b/docs/data-sources/compute_flavors.md index 7e74ab4004..26767b852d 100644 --- a/docs/data-sources/compute_flavors.md +++ b/docs/data-sources/compute_flavors.md @@ -10,9 +10,10 @@ Use this data source to get the ID of the available Compute Flavors. ```hcl data "huaweicloud_compute_flavors" "flavors" { - performance_type = "normal" - cpu_core_count = 2 - memory_size = 4096 + availability_zone = "cn-north-4a" + performance_type = "normal" + cpu_core_count = 2 + memory_size = 4 } # Create ECS instance with the first matched flavor @@ -34,7 +35,7 @@ resource "huaweicloud_compute_instance" "instance" { * `cpu_core_count` - (Optional) Specifies the number of vCPUs in the ECS flavor. -* `memory_size` - (Optional) Specifies the memory size(MB) in the ECS flavor. +* `memory_size` - (Optional) Specifies the memory size(GB) in the ECS flavor. ## Attributes Reference diff --git a/docs/resources/compute_instance.md b/docs/resources/compute_instance.md index accb71758a..23bcf02ce9 100644 --- a/docs/resources/compute_instance.md +++ b/docs/resources/compute_instance.md @@ -15,9 +15,10 @@ This is an alternative to `huaweicloud_compute_instance_v2` data "huaweicloud_availability_zones" "myaz" {} data "huaweicloud_compute_flavors" "myflavor" { - performance_type = "normal" - cpu_core_count = 2 - memory_size = 4096 + availability_zone = data.huaweicloud_availability_zones.myaz.names[0] + performance_type = "normal" + cpu_core_count = 2 + memory_size = 4 } data "huaweicloud_vpc_subnet" "mynet" { diff --git a/examples/ecs/associated-eip/main.tf b/examples/ecs/associated-eip/main.tf index 3160ac7f7d..9395cdac24 100644 --- a/examples/ecs/associated-eip/main.tf +++ b/examples/ecs/associated-eip/main.tf @@ -1,9 +1,10 @@ data "huaweicloud_availability_zones" "myaz" {} data "huaweicloud_compute_flavors" "myflavor" { - performance_type = "normal" - cpu_core_count = 2 - memory_size = 4096 + availability_zone = data.huaweicloud_availability_zones.myaz.names[0] + performance_type = "normal" + cpu_core_count = 2 + memory_size = 4 } data "huaweicloud_vpc_subnet" "mynet" { diff --git a/examples/ecs/attached-interface/main.tf b/examples/ecs/attached-interface/main.tf index fe09947bea..0074d608d8 100644 --- a/examples/ecs/attached-interface/main.tf +++ b/examples/ecs/attached-interface/main.tf @@ -1,9 +1,10 @@ data "huaweicloud_availability_zones" "myaz" {} data "huaweicloud_compute_flavors" "myflavor" { - performance_type = "normal" - cpu_core_count = 2 - memory_size = 4096 + availability_zone = data.huaweicloud_availability_zones.myaz.names[0] + performance_type = "normal" + cpu_core_count = 2 + memory_size = 4 } data "huaweicloud_vpc_subnet" "mynet" { diff --git a/examples/ecs/attached-volume/main.tf b/examples/ecs/attached-volume/main.tf index 82fbac16ef..f6396f59a4 100644 --- a/examples/ecs/attached-volume/main.tf +++ b/examples/ecs/attached-volume/main.tf @@ -1,9 +1,10 @@ data "huaweicloud_availability_zones" "myaz" {} data "huaweicloud_compute_flavors" "myflavor" { - performance_type = "normal" - cpu_core_count = 2 - memory_size = 4096 + availability_zone = data.huaweicloud_availability_zones.myaz.names[0] + performance_type = "normal" + cpu_core_count = 2 + memory_size = 4 } data "huaweicloud_vpc_subnet" "mynet" { diff --git a/examples/ecs/basic/main.tf b/examples/ecs/basic/main.tf index 9d536cd520..9bf59c4b90 100644 --- a/examples/ecs/basic/main.tf +++ b/examples/ecs/basic/main.tf @@ -1,9 +1,10 @@ data "huaweicloud_availability_zones" "myaz" {} data "huaweicloud_compute_flavors" "myflavor" { - performance_type = "normal" - cpu_core_count = 2 - memory_size = 4096 + availability_zone = data.huaweicloud_availability_zones.myaz.names[0] + performance_type = "normal" + cpu_core_count = 2 + memory_size = 4 } data "huaweicloud_vpc_subnet" "mynet" { diff --git a/examples/ecs/provisioners/main.tf b/examples/ecs/provisioners/main.tf index 00413ceb55..445c580db3 100644 --- a/examples/ecs/provisioners/main.tf +++ b/examples/ecs/provisioners/main.tf @@ -1,9 +1,10 @@ data "huaweicloud_availability_zones" "myaz" {} data "huaweicloud_compute_flavors" "myflavor" { - performance_type = "normal" - cpu_core_count = 2 - memory_size = 4096 + availability_zone = data.huaweicloud_availability_zones.myaz.names[0] + performance_type = "normal" + cpu_core_count = 2 + memory_size = 4 } data "huaweicloud_vpc_subnet" "mynet" { diff --git a/examples/ecs/userdata/main.tf b/examples/ecs/userdata/main.tf index 83f955e75d..6e4e63bdfd 100644 --- a/examples/ecs/userdata/main.tf +++ b/examples/ecs/userdata/main.tf @@ -1,9 +1,10 @@ data "huaweicloud_availability_zones" "myaz" {} data "huaweicloud_compute_flavors" "myflavor" { + availability_zone = data.huaweicloud_availability_zones.myaz.names[0] performance_type = "normal" cpu_core_count = 2 - memory_size = 4096 + memory_size = 4 } data "huaweicloud_vpc_subnet" "mynet" { diff --git a/huaweicloud/data_source_huaweicloud_compute_flavors.go b/huaweicloud/data_source_huaweicloud_compute_flavors.go index b78aa2821e..c4e2b1c3ad 100644 --- a/huaweicloud/data_source_huaweicloud_compute_flavors.go +++ b/huaweicloud/data_source_huaweicloud_compute_flavors.go @@ -70,7 +70,7 @@ func dataSourceEcsFlavorsRead(d *schema.ResourceData, meta interface{}) error { } cpu := d.Get("cpu_core_count").(int) - mem := int64(d.Get("memory_size").(int)) + mem := int64(d.Get("memory_size").(int)) * 1024 pType := d.Get("performance_type").(string) gen := d.Get("generation").(string) az := d.Get("availability_zone").(string) diff --git a/huaweicloud/data_source_huaweicloud_compute_flavors_test.go b/huaweicloud/data_source_huaweicloud_compute_flavors_test.go index e8ecca65ce..3b6e1a73c2 100644 --- a/huaweicloud/data_source_huaweicloud_compute_flavors_test.go +++ b/huaweicloud/data_source_huaweicloud_compute_flavors_test.go @@ -42,6 +42,6 @@ const testAccEcsFlavorsDataSource_basic = ` data "huaweicloud_compute_flavors" "this" { performance_type = "normal" cpu_core_count = 2 - memory_size = 4096 + memory_size = 4 } `