orange-cloudavenue / terraform-provider-cloudavenue

Terraform Cloud Avenue provider
https://registry.terraform.io/providers/orange-cloudavenue/cloudavenue
Mozilla Public License 2.0
15 stars 3 forks source link

[Bug]: Impossible to update CPU in a VDC #511

Closed fmaitrot closed 1 year ago

fmaitrot commented 1 year ago

Terraform Core Version

1.5.3

Cloud Avenue Provider Version

0.10.0

Affected Resource(s)

cloudavenue_vdc

Expected Behavior

terraspace --version 2.2.13 Terraform v1.5.3 orange-cloudavenue/cloudavenue 0.10.0 vmware/vcd v3.10.0

In order to test the modification of the resources available in a VDC, I am modifying the cpu_allocated argument on our standard VDC. But I'm having problems performing this action.

` Terraform will perform the following actions:

cloudavenue_vdc.std_vdc will be updated in-place

~ resource "cloudavenue_vdc" "std_vdc" { ~ cpu_allocated = 41000 -> 42000 `

Actual Behavior

Impossible to update the VDC VDC Group field is not updated

Relevant Error/Panic Output Snippet

`
  Enter a value: yes 
cloudavenue_vdc.std_vdc: Modifying... [id=urn:vcloud:vdc:0539d2a0-06e2-4d41-bf7e-03ca992f8725]
╷
│ Error: Incorrect org VDC parameter (HTTP Code => 406)
│ 
│   with cloudavenue_vdc.std_vdc,
│   on vdcs.tf line 8, in resource "cloudavenue_vdc" "std_vdc":
│    8: resource "cloudavenue_vdc" "std_vdc" {
│ 
│ VDC group name cannot be updated
`

Terraform Configuration Files

TBD

Steps to Reproduce

  1. Create VDC ressource
  2. Update CPU or RAM in the VDC

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

dmicheneau commented 1 year ago

I reproduce the Bug with the following configuration:

resource "cloudavenue_vdc" "example" {
  name                  = "MyVDC1"
  // vdc_group             = "MyGroup"
  description           = "Example vDC created by Terraform"
  cpu_allocated         = 22000
  memory_allocated      = 30
  cpu_speed_in_mhz      = 2200
  billing_model         = "PAYG"
  disponibility_class   = "ONE-ROOM"
  service_class         = "STD"
  storage_billing_model = "PAYG"
  storage_profiles = [{
    class   = "gold"
    default = true
    limit   = 500
  }]
}

resource "cloudavenue_vdc_group" "example" {
  name        = "MyGroup"
  vdc_ids = [
    cloudavenue_vdc.example.id,
  ]
}

The bug is affected when the resource cloudavenue_vdc_group is used.

dmicheneau commented 1 year ago

Fix in release v0.10.2

smolinari-obs commented 1 year ago

I still have the issue and i don't use cloudavenue_vdc_group resource.

$ terraform --version
Terraform v1.5.7
on linux_amd64
+ provider registry.terraform.io/orange-cloudavenue/cloudavenue v0.10.2

This is the code used to reproduce :

resource "cloudavenue_vdc" "std_vdc" {
  name                  = "DebugVDCAPI"
  description           = "VDC Standard Principal"
  cpu_allocated         = 22000
  memory_allocated      = 10
  cpu_speed_in_mhz      = 2200
  billing_model         = "PAYG"
  disponibility_class   = "ONE-ROOM"
  service_class         = "STD"
  storage_billing_model = "PAYG"

  storage_profiles = [
    {
      class   = "silver"
      default = true
      limit   = 500
    },
  ]
}

When i change cpu_allocated or an other attribute i got the same error

cloudavenue_vdc.std_vdc: Refreshing state... [id=urn:vcloud:vdc:4e3f6b4b-427f-424d-9ce6-1018f7797a8c]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # cloudavenue_vdc.std_vdc will be updated in-place
  ~ resource "cloudavenue_vdc" "std_vdc" {
      ~ cpu_allocated         = 11000 -> 22000
        id                    = "urn:vcloud:vdc:4e3f6b4b-427f-424d-9ce6-1018f7797a8c"
        name                  = "DebugVDCAPI"
        # (8 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
cloudavenue_vdc.std_vdc: Modifying... [id=urn:vcloud:vdc:4e3f6b4b-427f-424d-9ce6-1018f7797a8c]
╷
│ Error: Incorrect org VDC parameter (HTTP Code => 406)
│ 
│   with cloudavenue_vdc.std_vdc,
│   on main.tf line 4, in resource "cloudavenue_vdc" "std_vdc":
│    4: resource "cloudavenue_vdc" "std_vdc" {
│ 
│ VDC group name cannot be updated
╵
dmicheneau commented 1 year ago

I reproduce the bug. re-open the issue

dmicheneau commented 1 year ago

Fix last bug and validate with Test with and without vdcgroup.

❯ terraform apply
╷
│ Warning: Provider development overrides are in effect
│ 
│ The following provider development overrides are set in the CLI configuration:
│  - orange-cloudavenue/cloudavenue in /Users/go/bin
│ 
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases.
╵
cloudavenue_vdc.example: Refreshing state... [id=urn:vcloud:vdc:ef3bf897-3a2b-4101-8ed9-xxxxx]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # cloudavenue_vdc.example will be updated in-place
  ~ resource "cloudavenue_vdc" "example" {
        id                    = "urn:vcloud:vdc:ef3bf897-3a2b-4101-8ed9-xxxxxxx"
      ~ memory_allocated      = 40 -> 50
        name                  = "MyVDC"
        # (8 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

cloudavenue_vdc.example: Modifying... [id=urn:vcloud:vdc:ef3bf897-3a2b-4101-8ed9-xxxxx]
cloudavenue_vdc.example: Still modifying... [id=urn:vcloud:vdc:ef3bf897-3a2b-4101-8ed9-xxxxx, 10s elapsed]
cloudavenue_vdc.example: Modifications complete after 11s [id=urn:vcloud:vdc:ef3bf897-3a2b-4101-8ed9-xxxxx]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
dmicheneau commented 1 year ago

A new version v0.10.4 was set to fix all possibilities to update a vdc with vdc group resource or field