Open hani010 opened 1 year ago
Hi @hani010 ! Can you try adding an explicit dependency to the nxos_port_channel_interface
resource and check if that makes a difference:
resource "nxos_port_channel_interface" "r_nxos_port_channel_interface" {
...
depends_on = [nxos_port_channel_interface_member.r_nxos_port_channel_interface_member]
}
Hi, yes i try this and other depends, but nothing works correct. My workaround is, i start with one member and then i add all other members, or i execute terraform apply two times...
Hi @hani010,
I had the same problem before.
You could try putting the "nxos_physical_interface" resource part of the dependecy.
resource "nxos_physical_interface" "po_member_phy_interface" {
device = each.value.device
description = each.value.description
layer = "Layer2"
interface_id = each.value.interface_dn
admin_state = "up"
mode = "trunk"
trunk_vlans = "1-4094"
}
resource "nxos_port_channel_interface" "po_inteface" {
device = each.value.device
interface_id = each.value.interface_id
description = each.value.description
port_channel_mode = "active"
suspend_individual = "enable"
auto_negotiation = "on"
speed = "auto"
admin_state = "up"
layer = "Layer2"
mode = "trunk"
trunk_vlans = "1-4094"
}
resource "nxos_port_channel_interface_member" "po_inteface_member" {
device = each.value.device
interface_id = each.value.interface_id
interface_dn = "sys/intf/phys-[${each.value.interface_dn}]"
depends_on = [
nxos_physical_interface.po_member_phy_interface, nxos_port_channel_interface.po_inteface
]
}
@danischm Is it possible to add a new schema item to perform 'Channel group force' for "nxos_port_channel_interface_member" resource ?
It seems possible from the API documentation. https://pubhub.devnetcloud.com/media/dme-docs-10-2-2/docs/Interfaces/pc:RsMbrIfs/
Added the force
option in v0.5.2 release. Can this be considered resolved now?
I tested the force
is working.
But, it can't be used to update existing port-channel config (eg: vlans, switch mode) as the nxos_physical_interface
resource cannot be dynamically updated for subsequent "terraform apply"
I guess this is the nature of terraform, which it is great as to deploy the infrastructure. But for operational tasks, such as port configuration changes, it's necessary to fall back to using Ansible.
We are experiencing a similar issue, when keeping the vlan list empty and specifying vlans on the port channel interface, a change in the vlans results in an error:
│ Error: Client Error
│
│ with nxos_physical_interface.leafs-default-interfaces["LEAF01-G3.30"],
│ on leafs-interfaces.tf line 1, in resource "nxos_physical_interface" "leafs-default-interfaces":
│ 1: resource "nxos_physical_interface" "leafs-default-interfaces" {
│
│ Failed to update object, got error: JSON error: {"imdata":[{"error": {"attributes": {"code": "1","text": "ERROR: : port already in a port-channel, no config
│ allowed\nfaulty_dn=sys\/intf\/phys-[eth1\/30], Pkg=l1, biStatus=endCommonCb"}}}]}
Using the force parameter does not change the behavior and dependencies should be in correct order.
As mentioned above, it looks like the provider (0.5.4) is having issues when changing the vlan list on a port-channel.
Hi
What about using the lifecycle
meta-argument on the nxos_physical_interface
resource?
resource "nxos_physical_interface" "r_nxos_physical_interface" {
for_each = toset(var.physical_intfs)
interface_id = each.key
admin_state = var.admin_state
description = var.description
mode = var.switchport_mode
# trunk_vlans = var.trunk_vlans_po
lifecycle {
ignore_changes = [
trunk_vlans,
mode,
]
}
}
Would you mind sharing the NXOS version you are using? I have experiences some issues while destroying the resource nxos_physical_interface
on NXOS version 9.3(8)
. The POST
operation to restore the resource times out. I do not see any issues on version 9.3(10)
Hi Jorge,
We are running with version NXOS: version 10.3(5) [Maintenance Release]
Your hint to use the lifecycle argument looks very promising. Changing the number of configured vlans on the port-channel interface is now properly reflected on the physical interfaces. Will have to do some more testing, but it looks you resolved our issue.
Regards, Eric.
Hello,
we wrote an modul that create interfaces and an portchannel but got an error when trying to attached multiple interfaces to the portchannel. This first interfaces is fine, but we get an error to add the other interfaces. When apply terrafrom again, everthing is fine.
Module main.tf
Calling the module
Error Message