You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixing Terraform Configuration Error with iosxe_restconf on CAT9K
We are using iosxe_restconf to configure the interface for a CAT9K device. Our code is as follows. After applying it in Terraform, the following error was reported: Can you help me fix it?
Thank you very much!
resource "iosxe_restconf" "gigabit_ethernet" {
path = "Cisco-IOS-XE-native:native/interface"
lists = [
{
name = "GigabitEthernet"
key = "name"
items = [
{
name = "1/0/10"
description = "Configured via Terraform"
switchport-config = jsonencode({
switchport = {
"Cisco-IOS-XE-switch:access" = {
vlan = {
vlan = 18
}
},
"Cisco-IOS-XE-switch:mode" = {
access = {}
}
}
})
}
]
}
]
}
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# iosxe_restconf.gigabit_ethernet will be updated in-place
~ resource "iosxe_restconf" "gigabit_ethernet" {
~ attributes = {} -> (known after apply)
id = "Cisco-IOS-XE-native:native/interface"
~ lists = [
~ {
~ items = [
~ {
~ "description" = "Configured via test" -> "Configured via Terraform"
+ "switchport-config" = jsonencode(
{
+ switchport = {
+ "Cisco-IOS-XE-switch:access" = {
+ vlan = {
+ vlan = 18
}
}
+ "Cisco-IOS-XE-switch:mode" = {
+ access = {}
}
}
}
)
# (1 unchanged element hidden)
},
]
name = "GigabitEthernet"
# (1 unchanged attribute hidden)
},
]
# (2 unchanged attributes hidden)
}
Plan: 0 to add, 1 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_restconf.gigabit_ethernet: Modifying... [id=Cisco-IOS-XE-native:native/interface]
╷
│ Error: Client Error
│
│ with iosxe_restconf.gigabit_ethernet,
│ on interface_restconf.tf line 1, in resource "iosxe_restconf" "gigabit_ethernet":
│ 1: resource "iosxe_restconf" "gigabit_ethernet" {
│
│ Failed to configure object (PATCH), got error: HTTP Request failed: StatusCode 400, RESTCONF errors {Error:[{ErrorType:application ErrorTag:malformed-message ErrorAppTag:
│ ErrorPath:/Cisco-IOS-XE-native:native/interface ErrorMessage:invalid value for: switchport-config in
│ /ios:native/ios:interface/ios:GigabitEthernet[ios:name='1/0/10']/ios:switchport-config ErrorInfo:}]} {PatchId: GlobalStatus:{Ok:false Errors:{Error:[]}}
│ EditStatus:{Edit:[]} Errors:{Error:[]}}
The text was updated successfully, but these errors were encountered:
Fixing Terraform Configuration Error with iosxe_restconf on CAT9K
We are using iosxe_restconf to configure the interface for a CAT9K device. Our code is as follows. After applying it in Terraform, the following error was reported: Can you help me fix it?
Thank you very much!
The text was updated successfully, but these errors were encountered: