Skip to content

junos_vlan

Experimental. A VLAN on a Juniper EX or QFX switch running ELS, by name, and its ID. Interfaces and descriptions on it are left alone.

Experimental. Network devices are new, and this module may change between releases. It’s tested against vJunos-switch 26.2R1.7 on a lab VM, not yet in CI.

Use junos_vlan to create a VLAN on a Juniper EX or QFX switch running ELS, and give it an ID. Junos keys VLANs by name, so the name is what the step owns, and changing vlan_id updates it in place. Only the ID is owned: interfaces and a description you add elsewhere are left alone. Removing the step deletes the VLAN, everything under it included, unless on_remove = "forget". The change goes in like every Junos step does; see junos_config.

step "users" {
junos_vlan {
name = "users"
vlan_id = 10
}
}

One step per VLAN, from a map:

step "vlans" {
for_each = { users = 10, voice = 20, iot = 30 }
junos_vlan {
name = item.key
vlan_id = item.value
}
}
Name Type Required Description
name string Yes VLAN name, as Junos keys VLANs, such as users. It starts with a letter.
on_remove string No What happens on the device when this resource is removed: “delete” (default) deletes the VLAN, everything under it included; “forget” leaves it.
vlan_id number Yes VLAN ID, 1 to 4094.

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

Name Type Description
in_sync bool Whether the VLAN was there with this ID at the last refresh.
revision string Changes each time Conn3x changes this on the host. Handlers watch it.

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