G-Core / terraform-provider-gcore

Gcore Terraform Provider
https://gcore.com
Mozilla Public License 2.0
14 stars 11 forks source link

resource gcore_instancev2 with multiple network interface consist only one interface description #138

Open se-scratch opened 1 month ago

se-scratch commented 1 month ago

I am creating a vm with two network interfaces, but resource.gcore_instancev2 after creating consist only one interface description.

    "interface" = toset([
      {
        "existing_fip_id" = "8c49aa11-7d6f-4cdf-b65b-d3922924f1b3"
        "ip_address" = "192.168.60.111"
        "ip_family" = ""
        "name" = "example-vm1_int_1"
        "network_id" = "4f77ae5b-afca-440a-9867-907152879630"
        "order" = 1
        "port_id" = "357391d9-14b8-442a-a0aa-d93b86644847"
        "security_groups" = tolist([
          "9e88289b-74d1-4fd2-9eb0-538d56cdeeba",
        ])
        "subnet_id" = "aff4980d-bc91-474d-97ae-e9d5f732ccde"
        "type" = "reserved_fixed_ip"
      },
    ])

data.gcore_instance contains correct information:

"interface" = tolist([
      {
        "ip_address" = "192.168.60.111"
        "network_id" = "4f77ae5b-afca-440a-9867-907152879630"
        "port_id" = "357391d9-14b8-442a-a0aa-d93b86644847"
        "subnet_id" = "aff4980d-bc91-474d-97ae-e9d5f732ccde"
      },
      {
        "ip_address" = "192.168.70.145"
        "network_id" = "4f77ae5b-afca-440a-9867-907152879630"
        "port_id" = "a4bd9d59-10ee-458b-a2b3-1904dfca0e3d"
        "subnet_id" = "a07b81f0-b481-4f56-bdd4-87798f6c980d"
      },
    ])

And if I launch terraform apply again, there will be an attempt to change the VM configuration with the connection of a new interface, which will end with an error, bacause the interface is already connected.

 gcore_instancev2.server["example-vm1"] will be updated in-place
  ~ resource "gcore_instancev2" "server" {
        id           = "76fab106-dc96-4786-b346-b7a668a4db84"
        name         = "example-vm1"
        # (9 unchanged attributes hidden)

      - interface {
          - existing_fip_id = "8c49aa11-7d6f-4cdf-b65b-d3922924f1b3" -> null
          - ip_address      = "192.168.60.111" -> null
          - name            = "example-vm1_int_1" -> null
          - network_id      = "4f77ae5b-afca-440a-9867-907152879630" -> null
          - order           = 1 -> null
          - port_id         = "357391d9-14b8-442a-a0aa-d93b86644847" -> null
          - security_groups = [
              - "9e88289b-74d1-4fd2-9eb0-538d56cdeeba",
            ] -> null
          - subnet_id       = "aff4980d-bc91-474d-97ae-e9d5f732ccde" -> null
          - type            = "reserved_fixed_ip" -> null
            # (1 unchanged attribute hidden)
        }
      + interface {
          + existing_fip_id = "8c49aa11-7d6f-4cdf-b65b-d3922924f1b3"
          + ip_address      = (known after apply)
          + name            = "example-vm1_int_0"
          + network_id      = (known after apply)
          + order           = 0
          + port_id         = "357391d9-14b8-442a-a0aa-d93b86644847"
          + security_groups = [
              + "9e88289b-74d1-4fd2-9eb0-538d56cdeeba",
            ]
          + subnet_id       = (known after apply)
          + type            = "reserved_fixed_ip"
            # (1 unchanged attribute hidden)
        }
      + interface {
          + ip_address      = "192.168.60.111"
          + name            = "example-vm1_int_1"
          + network_id      = "4f77ae5b-afca-440a-9867-907152879630"
          + order           = 1
          + port_id         = "a4bd9d59-10ee-458b-a2b3-1904dfca0e3d"
          + security_groups = [
              + "9e88289b-74d1-4fd2-9eb0-538d56cdeeba",
            ]
          + subnet_id       = "aff4980d-bc91-474d-97ae-e9d5f732ccde"
          + type            = "reserved_fixed_ip"
        }

        # (1 unchanged block hidden)
    }
daragok commented 1 month ago

Hi, thank you for reporting this problem.

We are working on fixing this issue already and hope to have it resolved by the end of next week

alexk53 commented 3 weeks ago

Hi, thank you for waiting, it should be fixed in version v0.8.31