Skip to content

Reordering network_interfaces on servers re-assignes IPs #650

@Xartos

Description

@Xartos

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions