Skip to content

eos_interface

Experimental. The settings Conn3x owns on one interface of an Arista EOS switch: description, enabled, switchport mode and VLANs, MTU. Each one left unset is left alone, and so is every other line under the interface.

Experimental. Network devices are new, and this module may change between releases. It’s tested against cEOS-lab 4.37.0F on a local machine, not yet in CI, so try it on a lab switch first.

Use eos_interface to own the everyday settings of one interface on an Arista EOS switch: its description, whether it’s up, access or trunk, its VLANs and its MTU. Each setting you leave out is left alone, and so is every other line under the interface, such as an IP address or a load interval. The change goes through the same config session as every other eos_* step on the switch: committed with a revert timer, confirmed over a new login, then saved.

An uplink trunk:

step "uplink" {
eos_interface {
name = "Ethernet1"
description = "to spine1"
mode = "trunk"
allowed_vlans = [10, 20, 30]
mtu = 9214
}
}

An access port for one VLAN:

step "printer" {
eos_interface {
name = "Ethernet12"
description = "printer, 2nd floor"
mode = "access"
access_vlan = 30
}
}

Shut down ports nobody uses:

step "unused" {
for_each = toset(["Ethernet40", "Ethernet41", "Ethernet42"])
eos_interface {
name = item.value
enabled = false
}
}
Name Type Required Description
access_vlan number No The VLAN of an access port, 1 to 4094.
allowed_vlans list of number No The VLANs a trunk carries. Conn3x writes them the way EOS prints them, as in 10,20-22.
description string No Its description.
enabled bool No false shuts it down, true brings it up. Shutting down the interface whose address Conn3x connects to is refused.
mode string No “access” or “trunk”. Ethernet and Port-Channel interfaces only.
mtu number No MTU, 68 to 9214.
name string Yes The interface, as running-config names it, such as Ethernet1, Ethernet1/1, Port-Channel10, Vlan20 or Loopback0.
on_remove string No What happens when this resource is removed: “forget” (default) leaves the interface as it is, “delete” takes the settings it owns back to EOS’s defaults. The interface itself stays.

Conn3x sets these; reference them as conn3x_eos_interface.<circuit>__<step>["<host>"].<name>.

Name Type Description
in_sync bool Whether the interface had these settings at the last refresh.
revision string Changes each time Conn3x changes this on the host. Handlers watch it.

A step lowers to the conn3x_eos_interface resource, one instance per host, and connects with its circuit’s ssh block.

Conn3x compares the lines under interface <name> in running-config with what the step owns. EOS doesn’t print its defaults: an access port shows no switchport mode line, and access VLAN 1 shows none either. So mode = "access" takes a switchport mode trunk line away, and access_vlan = 1 takes a switchport access vlan line away.

A setting the step stops naming is left as it is. Turn a trunk into an access port and its switchport trunk allowed vlan list stays on the switch, unused, until something removes it.

Shutting down the interface whose address Conn3x connects to is refused before anything is sent: enabled = false on that interface fails with the reason. Through any other interface, a lockout is still caught by the revert timer.

With on_remove = "forget" (the default), removing the step leaves the interface as it is. With "delete", the settings the step owns go back to EOS’s defaults; the interface itself stays.