CiscoDevNet / terraform-provider-iosxe

Terraform Cisco IOS-XE Provider
https://registry.terraform.io/providers/CiscoDevNet/iosxe
Mozilla Public License 2.0
50 stars 22 forks source link

resource "iosxe_vlan" struggels with long vlan names #155

Closed Aswertus closed 1 month ago

Aswertus commented 1 month ago

I stumbled into the issue that at least the current version of the provider has issues creating or renaming vlans to long names.

Yes I'm aware that long vlan-names arent the smartest thing to do, but still I want to mention it.

 # iosxe_vlan.vlan["4021"] will be updated in-place
  ~ resource "iosxe_vlan" "vlan" {
        id       = "Cisco-IOS-XE-native:native/vlan/Cisco-IOS-XE-vlan:vlan-list=4021"
      ~ name     = "Link-Net4021" -> "Link-Net_htl-spielw-abt"
        # (2 unchanged attributes hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

iosxe_vlan.vlan["4021"]: Modifying... [id=Cisco-IOS-XE-native:native/vlan/Cisco-IOS-XE-vlan:vlan-list=4021]
iosxe_vlan.vlan["4021"]: Still modifying... [id=Cisco-IOS-XE-native:native/vlan/Cisco-IOS-XE-vlan:vlan-list=4021, 10s elapsed]
iosxe_vlan.vlan["4021"]: Still modifying... [id=Cisco-IOS-XE-native:native/vlan/Cisco-IOS-XE-vlan:vlan-list=4021, 20s elapsed]
╷
│ Error: Client Error
│
│   with iosxe_vlan.vlan["4021"],
│   on switching.tf line 33, in resource "iosxe_vlan" "vlan":
│   33: resource "iosxe_vlan" "vlan" {
│
│ Failed to configure object (PATCH), got error: HTTP Request failed: StatusCode 400, RESTCONF errors {Error:[{ErrorType:application ErrorTag:invalid-value ErrorAppTag:
│ ErrorPath:/Cisco-IOS-XE-native:native/vlan/Cisco-IOS-XE-vlan:vlan-list ErrorMessage:inconsistent value: Device refused one or more commands ErrorInfo:}]} {PatchId: GlobalStatus:{Ok:false
│ Errors:{Error:[]}} EditStatus:{Edit:[]} Errors:{Error:[]}}

If I try it with a shorter name it works

# iosxe_vlan.vlan["4021"] will be created
  + resource "iosxe_vlan" "vlan" {
      + id       = (known after apply)
      + name     = "Link-Net4021"
      + shutdown = false
      + vlan_id  = 4021
    }

Plan: 2 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

iosxe_vlan.vlan["4021"]: Creating...
iosxe_vlan.vlan["4021"]: Creation complete after 0s [id=Cisco-IOS-XE-native:native/vlan/Cisco-IOS-XE-vlan:vlan-list=4021]
iosxe_interface_vlan.l3-interface["4021"]: Creating...
iosxe_interface_vlan.l3-interface["4021"]: Creation complete after 3s [id=Cisco-IOS-XE-native:native/interface/Vlan=4021]

Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
danischm commented 1 month ago

Does it work when you configure it on the CLI or do you get some kind of warning?

Aswertus commented 1 month ago

Sorry for the delay of my respone!

On the CLI everything works fine. Interestingly the error went disappeared and havent happened again. I'm sure nobody else changed anything in the meantime.

Very interesting nonetheless ^^