jeremmfr / terraform-provider-junos

Terraform provider for Junos devices
https://registry.terraform.io/providers/jeremmfr/junos
MIT License
62 stars 22 forks source link

Feature request: interface-mode access #557

Closed rronek closed 1 year ago

rronek commented 1 year ago

Description

New or Affected Resource(s)

jeremmfr commented 1 year ago

Hi @rronek 👋

As the default mode is already access, I didn't see the point of adding an argument to add this line. There may be a case where it is necessary to add this line, but I don't know what it is. Do you have any more information on this potential case ?

rronek commented 1 year ago

Hi @jeremmfr

you're right, the default is access,I did not know Thanks for the clarification

zPools commented 1 month ago

Hi @jeremmfr,

sorry to bring this old issue up again. I want to configure an interface so that it is access on a specific vlan.

Here is my HCL:

resource "junos_interface_physical" "interface_switch_demo" {
  name         = "ge-0/0/16"
  description  = "interfaceSwitchDemo"
  vlan_members = [ "vlan0950" ]
}

Errors out with the following:

â•·
│ Error: Config Commit Error
│ 
│   with junos_interface_physical.interface_switch_demo,
│   on main.tf line 29, in resource "junos_interface_physical" "interface_switch_demo":
│   29: resource "junos_interface_physical" "interface_switch_demo" {
│ 
│ netconf rpc [error]
│ [edit interfaces ge-0/0/16 unit 0 family ethernet-switching]
│   'vlan'
│     Access interface can be part of only one vlan 
│ netconf rpc [error] configuration check-out failed

I try to archive following junos config:

zpools@somesw01# show interfaces ge-0/0/16 
description interfaceSwitchDemo;
unit 0 {
    family ethernet-switching {
        interface-mode access;
        vlan {
            members vlan0950;
        }
    }
}

{master:0}[edit]
zpools@somesw01# 

Is this a bug or am I just to dump to find the correct resource?

jeremmfr commented 1 month ago

Hi @zPools

The Terraform config is correct for your needs. It doesn't produce this error under normal circumstances.

I think there is an apply-groups in Junos config that adds a second vlan on the interface and produces this error.

zPools commented 1 month ago

Thank you @jeremmfr, Turns out, a colleague and I made changes to the very same switch.

He did an interface range that I did not see. Only when I did the good old | display inheritance i caught it.

Providers works as expected.