Skip to content

Commit

Permalink
ECS: fix opentelekomcloud_compute_instance_v2 flavor set for SWISS (#…
Browse files Browse the repository at this point in the history
…2670)

ECS: fix `opentelekomcloud_compute_instance_v2` flavor set for SWISS

Summary of the Pull Request
Fix flavor set for swisscloud
PR Checklist

 Refers to: #2663
 Schema updated.
 Release notes added.

Reviewed-by: Anton Sidelnikov
  • Loading branch information
artem-lifshits authored Oct 2, 2024
1 parent 6880166 commit b852119
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 29 deletions.
2 changes: 2 additions & 0 deletions docs/resources/compute_instance_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 = {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 4 additions & 0 deletions releasenotes/notes/compute_v2_swiss-ccf2c4b15842ad11.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
**[ECS]** Flavor set fix for ``resource/opentelekomcloud_compute_instance_v2`` for SWISS (`#2670 <https://github.com/opentelekomcloud/terraform-provider-opentelekomcloud/pull/2670>`_)

0 comments on commit b852119

Please sign in to comment.