diff --git a/docs/resources/compute_instance_v2.md b/docs/resources/compute_instance_v2.md index 9111b8f65..597f665a6 100644 --- a/docs/resources/compute_instance_v2.md +++ b/docs/resources/compute_instance_v2.md @@ -15,6 +15,8 @@ Up-to-date reference of API arguments for ECS management you can get at Manages a V2 VM instance resource within OpenTelekomCloud. +-> **NOTE:** Compute v2 API that are used in this resource aren't officially supported on SwissCloud. + ## Example Usage ### Basic Instance diff --git a/opentelekomcloud/acceptance/ecs/resource_opentelekomcloud_compute_instance_v2_test.go b/opentelekomcloud/acceptance/ecs/resource_opentelekomcloud_compute_instance_v2_test.go index 07af8a667..ddd65d9f7 100644 --- a/opentelekomcloud/acceptance/ecs/resource_opentelekomcloud_compute_instance_v2_test.go +++ b/opentelekomcloud/acceptance/ecs/resource_opentelekomcloud_compute_instance_v2_test.go @@ -543,8 +543,8 @@ resource "opentelekomcloud_compute_instance_v2" "instance_1" { description = "my_desc" availability_zone = "%s" - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" metadata = { foo = "bar" @@ -571,8 +571,8 @@ resource "opentelekomcloud_compute_instance_v2" "instance_1" { description = "my_desc" availability_zone = "%s" - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" metadata = { foo = "bar" @@ -594,8 +594,8 @@ resource "opentelekomcloud_compute_instance_v2" "instance_1" { availability_zone = "%s" description = "my_desc_updated" - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" network { uuid = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id @@ -637,8 +637,8 @@ resource "opentelekomcloud_compute_secgroup_v2" "secgroup_2" { resource "opentelekomcloud_compute_instance_v2" "instance_1" { name = "instance_1" security_groups = ["default"] - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" network { uuid = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id } @@ -674,8 +674,8 @@ resource "opentelekomcloud_compute_secgroup_v2" "secgroup_2" { resource "opentelekomcloud_compute_instance_v2" "instance_1" { name = "instance_1" - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" security_groups = [ "default", @@ -727,7 +727,7 @@ resource "opentelekomcloud_blockstorage_volume_v2" "vol_1" { resource "opentelekomcloud_compute_instance_v2" "instance_1" { name = "instance_1" - flavor_id = "s2.medium.1" + flavor_id = "s3.large.2" security_groups = ["default"] network { uuid = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id @@ -749,7 +749,7 @@ var testAccComputeV2InstanceBootFromVolume = fmt.Sprintf(` resource "opentelekomcloud_compute_instance_v2" "instance_1" { name = "instance_1" - flavor_id = "s2.medium.1" + flavor_id = "s3.large.2" security_groups = ["default"] network { uuid = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id @@ -771,8 +771,8 @@ var testAccComputeV2InstanceFixedIP = fmt.Sprintf(` resource "opentelekomcloud_compute_instance_v2" "instance_1" { name = "instance_1" - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" security_groups = ["default"] network { uuid = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id @@ -787,8 +787,8 @@ var testAccComputeV2InstanceMetadata = fmt.Sprintf(` resource "opentelekomcloud_compute_instance_v2" "instance_1" { name = "instance_1" - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" security_groups = ["default"] network { uuid = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id @@ -806,8 +806,8 @@ var testAccComputeV2InstanceMetadataUpdate = fmt.Sprintf(` resource "opentelekomcloud_compute_instance_v2" "instance_1" { name = "instance_1" - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" security_groups = ["default"] network { uuid = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id @@ -825,8 +825,8 @@ var testAccComputeV2InstanceTimeout = fmt.Sprintf(` resource "opentelekomcloud_compute_instance_v2" "instance_1" { name = "instance_1" - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" security_groups = ["default"] network { uuid = data.opentelekomcloud_vpc_subnet_v1.shared_subnet.network_id @@ -844,8 +844,8 @@ var testAccComputeV2InstanceAutoRecovery = fmt.Sprintf(` resource "opentelekomcloud_compute_instance_v2" "instance_1" { name = "instance_1" - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" security_groups = ["default"] availability_zone = "%s" metadata = { @@ -876,8 +876,8 @@ resource "opentelekomcloud_vpc_subnet_v1" "subnet" { resource "opentelekomcloud_compute_instance_v2" "instance_1" { name = "instance_1" - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" security_groups = ["default"] network { @@ -896,8 +896,8 @@ var testAccComputeV2InstanceActive = fmt.Sprintf(` resource "opentelekomcloud_compute_instance_v2" "instance_1" { name = "instance_1" - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" security_groups = ["default"] power_state = "active" network { @@ -911,8 +911,8 @@ var testAccComputeV2InstanceShutoff = fmt.Sprintf(` resource "opentelekomcloud_compute_instance_v2" "instance_1" { name = "instance_1" - image_name = "Standard_Debian_10_latest" - flavor_id = "s2.medium.1" + image_name = "Standard_Debian_11_latest" + flavor_id = "s3.large.2" security_groups = ["default"] power_state = "shutoff" network { diff --git a/opentelekomcloud/services/ecs/resource_opentelekomcloud_compute_instance_v2.go b/opentelekomcloud/services/ecs/resource_opentelekomcloud_compute_instance_v2.go index e7dff4716..3023d233f 100644 --- a/opentelekomcloud/services/ecs/resource_opentelekomcloud_compute_instance_v2.go +++ b/opentelekomcloud/services/ecs/resource_opentelekomcloud_compute_instance_v2.go @@ -619,7 +619,10 @@ func resourceComputeInstanceV2Read(ctx context.Context, d *schema.ResourceData, flavorId, ok := server.Flavor["original_name"].(string) if !ok { - return fmterr.Errorf("error setting OpenTelekomCloud server's flavor: %v", server.Flavor) + flavorId, ok = server.Flavor["id"].(string) + if !ok { + return fmterr.Errorf("error setting OpenTelekomCloud server's flavor: %v", server.Flavor) + } } mErr = multierror.Append(mErr, d.Set("flavor_id", flavorId), diff --git a/releasenotes/notes/compute_v2_swiss-ccf2c4b15842ad11.yaml b/releasenotes/notes/compute_v2_swiss-ccf2c4b15842ad11.yaml new file mode 100644 index 000000000..8337ca508 --- /dev/null +++ b/releasenotes/notes/compute_v2_swiss-ccf2c4b15842ad11.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + **[ECS]** Flavor set fix for ``resource/opentelekomcloud_compute_instance_v2`` for SWISS (`#2670 `_)