Terraform Version
Terraform v1.1.7
Affected Resource(s)
Terraform Configuration Files
resource "iosxe_interface_ethernet" "example" {
name = "1/0/21"
type = "TwentyFiveGigE"
description = "foobar"
}
Debug Output
2022-05-11T13:38:26.249Z [DEBUG] provider.terraform-provider-iosxe: 2022/05/11 13:38:26 [DEBUG] HTTP Request: PATCH, https://172.21.142.23/restconf/data/Cisco-IOS-XE-native:native/interface/TwentyFiveGigE=1/0/21, {{"Cisco-IOS-XE-native:21":{"name":"1/0/21","description":"foobar"}}}
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: 2022/05/11 13:38:26 [DEBUG] HTTP Response: {
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: "ietf-restconf:errors": {
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: "error": [
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: {
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: "error-type": "application",
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: "error-tag": "invalid-value",
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: "error-message": "uri keypath not found"
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: }
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: ]
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: }
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: }
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: 2022/05/11 13:38:26 [ERROR] HTTP Request failed: StatusCode 404, RESTCONF errors {Error:[]} {PatchId: GlobalStatus:{Ok:false Errors:{Error:[]}} EditStatus:{Edit:[]}}
2022-05-11T13:38:26.256Z [DEBUG] provider.terraform-provider-iosxe: 2022/05/11 13:38:26 [DEBUG] Exit from Do method
Expected Behavior
Configure TwentyFiveGigE=1/0/21 interface
Actual Behavior
iosxe_interface_ethernet.example: Creating...
╷
│ Error: Client Error
│
│ with iosxe_interface_ethernet.example,
│ on main.tf line 24, in resource "iosxe_interface_ethernet" "example":
│ 24: resource "iosxe_interface_ethernet" "example" {
│
│ Failed to configure object (PATCH), got error: HTTP Request failed: StatusCode 404, RESTCONF errors {Error:[]} {PatchId: GlobalStatus:{Ok:false Errors:{Error:[]}} EditStatus:{Edit:[]}}
So there are 2 separate issues that having / in the name causes.
Path escaping is required in the URL:
https://172.21.142.23/restconf/data/Cisco-IOS-XE-native:native/interface/TwentyFiveGigE=1/0/21
needs to be
https://172.21.142.23/restconf/data/Cisco-IOS-XE-native:native/interface/TwentyFiveGigE=1%2F0%2F21
I attempted to resolve the path escaping by escaping the value going into the getPath function however this caused issues downstream as this function is used heavily through the resources.
Incorrect payload:
{"Cisco-IOS-XE-native:21":{"name":"1/0/21","description":"foobar"}}
should be
{"Cisco-IOS-XE-native:TwentyFiveGigE":{"name":"1/0/21","description":"foobar"}}
This is an issue with the helpers.LastElement function splitting on the "/".