terraform-provider-upcloud icon indicating copy to clipboard operation
terraform-provider-upcloud copied to clipboard

Reordering network_interfaces on servers re-assignes IPs

Open Xartos opened this issue 4 months ago • 3 comments

The problem

When reordering network interfaces blocks on a server it always recreates the interfaces and thus gives them a new IP.

For example if I have this in on a server:

network_interface {
  type    = "public"
}

network_interface {
  type    = "private"
  network = upcloud_network.private.id
}

Then I rearrange it to look like this:


network_interface {
  type    = "private"
  network = upcloud_network.private.id
}

network_interface {
  type    = "public"
}

When I then run plan I get the following change

      ~ network_interface {
          ~ network             = "<redacted>" -> "<redacted>"
          ~ type                = "public" -> "private"
            # (6 unchanged attributes hidden)
        }
      ~ network_interface {
          ~ type                = "private" -> "public"
            # (7 unchanged attributes hidden)
        }

And after running apply, both those NICs are recreated and get new IPs

Expected behaviour

I'd expect that the order shouldn't matter, but more importantly, the NICs should keep their addresses after they are reordered.

Xartos avatar Oct 03 '24 07:10 Xartos