Skip to content

Creating/Updating a nlb leads sometimes to: Listener IP and port combination already used by Network Load Balancer #585

@salyh

Description

@salyh

Description

Creating/Updating a nlb and forwarding rules sometimes lead to

 | error creating network loadbalancer: 422 Unprocessable Entity {
 |   "httpStatus" : 422,
 |   "messages" : [ {
 |     "errorCode" : "371",
 |     "message" : "[(root).properties.listenerIp] Listener IP and port combination 212.132.xxx.xxx:443 already used by Network Load Balancer."
 |   } ]
 | }

This is weird because when I see such an error everything looks fine in the DCD

Expected behavior

No error

Environment

Terraform version:

OpenTofu v1.7.2

Provider version:

v6.4.18

OS:

n/a

Configuration Files

resource "ionoscloud_networkloadbalancer" "XXX" {
  datacenter_id = ionoscloud_datacenter.XXX.id
  name          = "nlb-${var.ZZZ_uuid}"
  listener_lan  = ionoscloud_lan.XXX_lan_a_public.id
  target_lan    = ionoscloud_lan.XXX_lan_b_private.id
  ips = [ionoscloud_ipblock.XXX.ips[0]]
}

resource "ionoscloud_networkloadbalancer_forwardingrule" "XXX" {
  datacenter_id          = ionoscloud_datacenter.XXX.id
  networkloadbalancer_id = ionoscloud_networkloadbalancer.XXX.id
  name                   = "fwr1"
  algorithm              = "ROUND_ROBIN"
  protocol               = "TCP"
  listener_ip            = ionoscloud_ipblock.XXX.ips[0]
  listener_port          = "443"

  health_check {
    client_timeout = 50000
    connect_timeout = 2000
    target_timeout = 2000
    retries = 1
  }

  dynamic "targets" {
    for_each = local.lan_b_ips
    content {
      ip =  targets.value
      port           = "30443"
      weight         = "1"
      proxy_protocol = "v2"
      //proxy_protocol = "none"
      health_check {
        check          = true
        check_interval = 1000
      }
    }
  }
}

resource "ionoscloud_networkloadbalancer_forwardingrule" "adminapi" {
  datacenter_id          = ionoscloud_datacenter.XXX.id
  networkloadbalancer_id = ionoscloud_networkloadbalancer.XXX.id
  name                   = "fwr2"
  algorithm              = "ROUND_ROBIN"
  protocol               = "TCP"
  listener_ip            = ionoscloud_ipblock.XXX.ips[0]
  listener_port          = "8443"

  health_check {
    client_timeout = 50000
    connect_timeout = 2000
    target_timeout = 2000
    retries = 1
  }

  dynamic "targets" {
    for_each = local.lan_b_ips
    content {
      ip =  targets.value
      port           = "31443"
      weight         = "1"
      proxy_protocol = "none"
      health_check {
        check          = true
        check_interval = 1000
      }
    }
  }

Error and Debug Output

See internal ticket 207171781

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