Skip to content

Random IP order in ionoscloud_nic leads to continoues changes #903

@mueller-tobias

Description

@mueller-tobias

Description

We've a Tofu Modul that create two VMs with an OPNsense Image as a Firewall/Gateway. We need to attach multiple failover IPs to some NICs. This works fine so far. One Problem is that the ionoscloud_nic Resource or the Cloud API dosn't seem to preserve the order of the ip how Tofu sends them.

Expected behavior

The provider/Cloud API should retain the order of the IP that Tofu send to the Cloud API

Environment

Terraform version:

OpenTofu v1.10.7

Provider version:

ionoscloud v6.7.20

OS:

Ubuntu 24.04

Configuration Files

Here's an example of our Master NIC COnfiguration aka the Primary NIC of a failover resource:

resource "ionoscloud_nic" "opnsense_wan_nic_master" {
  depends_on = [ionoscloud_nic.opnsense_lan_nic]

  datacenter_id = var.datacenter_id
  server_id     = ionoscloud_server.gateway[local.gateway_vms[0]].id
  lan           = var.public_network_id
  name          = "${local.gateway_vms[0]}-wan"
  dhcp          = true
  ips           = flatten([ionoscloud_ipblock.vip["ingress-lb"].ips[0], ionoscloud_ipblock.vip["ingress-lb"].ips[2], local.additional_vip_ips])

  lifecycle {
    ignore_changes = [ipv6_ips, dhcpv6]
  }
}

The different Blocks have the following IPs:

  • ionoscloud_ipblock.vip["ingress-lb"].ips[0] = 212.112.58.15
  • ionoscloud_ipblock.vip["ingress-lb"].ips[2] = 212.112.58.16
  • local.additional_vip_ips = 85.211.45.12

When we do a tofu plan we always get this update due to the order:
09:11:40.278 STDOUT tofu: # module.gateway.ionoscloud_nic.opnsense_wan_nic_master will be updated in-place
09:11:40.278 STDOUT tofu: ~ resource "ionoscloud_nic" "opnsense_wan_nic_master" {
09:11:40.278 STDOUT tofu: id = "7961ad9f-295a-418e-a56e-88eba8881ddc"
09:11:40.278 STDOUT tofu: ~ ips = [
09:11:40.278 STDOUT tofu: "212.112.58.15",
09:11:40.279 STDOUT tofu: - "85.211.45.12",
09:11:40.279 STDOUT tofu: "212.112.58.16",
09:11:40.279 STDOUT tofu: + "85.211.45.12",
09:11:40.279 STDOUT tofu: ]
09:11:40.279 STDOUT tofu: name = "vdc-sandbox-east-gateway-0-wan"
09:11:40.279 STDOUT tofu: # (12 unchanged attributes hidden)
09:11:40.279 STDOUT tofu: }

Somehow not in every case the Cloud API seems to reorder the IPs. But we're not sure what is the "sorting" order. It seems not to be numeric. We've some deployment, with other IPs where the ordering is fine. The Tofu Modul we use there is the same. On two other deployment we constantly get this change, because the Cloud API returns not the wrong order of the IPs.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions