Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network interface starts "flapping" after reprovisioning of the VPX #79

Open
rein-tollevik opened this issue Nov 16, 2024 · 0 comments
Open

Comments

@rein-tollevik
Copy link

If the 'netscalersdx_provision_vpx' resource is used to reprovision the cpu or memory configuration of an existing VPX its channel interfaces will end up in a "flapping" state where it continuously goes down and up again. The undocumented 'device_channel_name' property of the network_interfaces must be set to the same value as the 'port_name' property to avoid the "flapping" state, which is what the GUI does when it changes the configuration.

It is tempting to always set the 'device_channel_name' to the 'port_name' value in the provider, but I haven't tested it on VPXs that don't use channel interfaces. And its name indicates that is should only be used with channels.

# Read the existing VPXs to get the mac addresses of the network interfaces, as they are
# required when changing an existing VPX.
data "http" "ns" {
  url = "https://${var.sdx_hostname}/nitro/v1/config/ns"

  request_headers = {
    "X-NITRO-USER" = var.sdx_username
    "X-NITRO-PASS" = var.sdx_password
  }
}

locals {
  vpx = [for n in jsondecode(data.http.ns.response_body).ns : n if n.name == var.vpx_name] 
  mac = length(local.vpx) == 0 ? {} : { for n in local.vpx.network_interfaces : n.port_name => n.mac_address }
}

resource "netscalersdx_provision_vpx" "vpx" {
  ...
  network_interfaces = [
    {
      port_name           = "LA/1"
      device_channel_name = "LA/1"
      mac_address         = try(local.mac["LA/1"], null) # Value only required when changing an existing VPX
      ...
    },
    {
      port_name           = "LA/2"
      device_channel_name = "LA/2"
      mac_address         = try(local.mac["LA/2"], null)
      ...
    },
  ]
}
rein-tollevik added a commit to rein-tollevik/terraform-provider-netscalersdx that referenced this issue Nov 16, 2024
rein-tollevik added a commit to rein-tollevik/terraform-provider-netscalersdx that referenced this issue Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant