I'm trying to import tf interface with type ethernet, because I couldn't put ethernet port description on port directly - it can only be modified.
when I import with:
terraform import dcnm_interface.eth_ports ethernet:FDO******HJ:Ethernet1/3:LAN-FABRIC-03
I get error: Error: Serial number is not valid. although the serial number of the switch is really good.
tf debug shows that serial_number is not passed to API, it remains null in API call request:
dcnm_interface.eth_ports: Import prepared!
Prepared dcnm_interface for import
dcnm_interface.eth_ports: Refreshing state... [id=Ethernet1/3]
2025-06-11T13:42:25.787+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG] Begining Read method Ethernet1/3: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 req https://<ndfc_url>/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 req https://<ndfc_url>/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 HTTP request GET /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3 &{GET https://<ndfc_url>/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNum
ber=null&ifName=Ethernet1/3 HTTP/1.1 1 1 map[Content-Type:[application/json]] 0 [] false <ndfc_url> map[] map[] map[] 0xc000032050}: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG] Begin Injection: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 req https://<ndfc_url>/login: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 req https://<ndfc_url>/login: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG] Begining Do method https://<ndfc_url>/login: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.875+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG] Ending Do method https://<ndfc_url>/login: timestamp="2025-06-11T13:42:25.875+0300"
2025-06-11T13:42:25.973+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 HTTP request after injection GET /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3 &{GET https://<ndfc_url>/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/int
erface?serialNumber=null&ifName=Ethernet1/3 HTTP/1.1 1 1 map[Authorization:[Bearer ************] Content-Type:[application/json]] 0 [] false <ndfc_url> map[] map[] map[] 0xc0000320
50}: timestamp="2025-06-11T13:42:25.875+0300"
2025-06-11T13:42:25.973+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG] Begining Do method https://<ndfc_url>/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3: timestamp="2025-06-11T13:42:25.875+0300"
2025-06-11T13:42:25.973+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG]
--[ HTTP Request ]------------------------------------
GET /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3 HTTP/1.1
Host: <ndfc_url>
User-Agent: Go-http-client/1.1
Authorization: Bearer ************
Content-Type: application/json
Accept-Encoding: gzip
---------------------------------------------: timestamp="2025-06-11T13:42:25.922+0300"
2025-06-11T13:42:25.973+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG]
--[ HTTP Response ]-----------------------------------
HTTP/1.1 500 Internal Server Error
Content-Length: 99
Cache-Control: no-cache, must-revalidate, proxy-revalidate, max-age=0
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://.qualtrics.com; style-src-elem 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; base-uri 'self'; frame-ancestors 'self'; font-src 'self' data:; img-src 'self' https://.qualtrics.com data: alln-extcloud-sto
rage.cisco.com; navigate-to ; worker-src 'self' blob:;frame-src 'self' https://.qualtrics.com ; connect-src 'self' https://*.qualtrics.com wss:;
Content-Type: application/json
Date: Wed, 11 Jun 2025 10:42:25 GMT
Referrer-Policy: strict-origin-when-cross-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Ratelimit-Limit: -1
X-Ratelimit-Remaining: -1
X-Ratelimit-Reset: 1559582945
X-Xss-Protection: 1; mode=block
[{"reportItemType":"ERROR","message":"Serial number is not valid","entity":"","line":0,"column":0}]
---------------------------------------------: timestamp="2025-06-11T13:42:25.922+0300"
2025-06-11T13:42:25.980+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG] Ending Do method https://<ndfc_url>/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3: timestamp="2025-06-11T13:42:25.975+0300"
2025-06-11T13:42:25.982+0300 [ERROR] vertex "import dcnm_interface.eth_ports result" error: Serial number is not valid
2025-06-11T13:42:25.993+0300 [ERROR] vertex "dcnm_interface.eth_ports (import id "ethernet:FDO******HJ:Ethernet1/3:LAN-FABRIC-P3")" error: Serial number is not valid
2025-06-11T13:42:25.993+0300 [ERROR] vertex "dcnm_interface.eth_ports (expand)" error: Serial number is not valid
╷
│ Error: Serial number is not valid
│
output of data "dcnm_inventory" "switch":
switch = {
+ deploy = true
+ fabric_name = "LAN-FABRIC-03"
+ id = "10...11"
+ ip = "10...11"
+ mode = "Normal"
+ model = "N9K-C93240YC-FX2"
+ role = "leaf"
+ serial_number = "FDOHJ"
+ switch_db_id = "380"
+ switch_name = "LEAF*******01-01"
}
I'm trying to import tf interface with type ethernet, because I couldn't put ethernet port description on port directly - it can only be modified.
when I import with:
terraform import dcnm_interface.eth_ports ethernet:FDO******HJ:Ethernet1/3:LAN-FABRIC-03
I get error: Error: Serial number is not valid. although the serial number of the switch is really good.
tf debug shows that serial_number is not passed to API, it remains null in API call request:
dcnm_interface.eth_ports: Import prepared!
Prepared dcnm_interface for import
dcnm_interface.eth_ports: Refreshing state... [id=Ethernet1/3]
2025-06-11T13:42:25.787+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG] Begining Read method Ethernet1/3: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 req https://<ndfc_url>/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 req https://<ndfc_url>/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 HTTP request GET /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3 &{GET https://<ndfc_url>/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNum
ber=null&ifName=Ethernet1/3 HTTP/1.1 1 1 map[Content-Type:[application/json]] 0 [] false <ndfc_url> map[] map[] map[] 0xc000032050}: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG] Begin Injection: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 req https://<ndfc_url>/login: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 req https://<ndfc_url>/login: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.789+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG] Begining Do method https://<ndfc_url>/login: timestamp="2025-06-11T13:42:25.787+0300"
2025-06-11T13:42:25.875+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG] Ending Do method https://<ndfc_url>/login: timestamp="2025-06-11T13:42:25.875+0300"
2025-06-11T13:42:25.973+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 HTTP request after injection GET /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3 &{GET https://<ndfc_url>/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/int
erface?serialNumber=null&ifName=Ethernet1/3 HTTP/1.1 1 1 map[Authorization:[Bearer ************] Content-Type:[application/json]] 0 [] false <ndfc_url> map[] map[] map[] 0xc0000320
50}: timestamp="2025-06-11T13:42:25.875+0300"
2025-06-11T13:42:25.973+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG] Begining Do method https://<ndfc_url>/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3: timestamp="2025-06-11T13:42:25.875+0300"
2025-06-11T13:42:25.973+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG]
--[ HTTP Request ]------------------------------------
GET /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3 HTTP/1.1
Host: <ndfc_url>
User-Agent: Go-http-client/1.1
Authorization: Bearer ************
Content-Type: application/json
Accept-Encoding: gzip
---------------------------------------------: timestamp="2025-06-11T13:42:25.922+0300"
2025-06-11T13:42:25.973+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG]
--[ HTTP Response ]-----------------------------------
HTTP/1.1 500 Internal Server Error
Content-Length: 99
Cache-Control: no-cache, must-revalidate, proxy-revalidate, max-age=0
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://.qualtrics.com; style-src-elem 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; base-uri 'self'; frame-ancestors 'self'; font-src 'self' data:; img-src 'self' https://.qualtrics.com data: alln-extcloud-sto
rage.cisco.com; navigate-to ; worker-src 'self' blob:;frame-src 'self' https://.qualtrics.com ; connect-src 'self' https://*.qualtrics.com wss:;
Content-Type: application/json
Date: Wed, 11 Jun 2025 10:42:25 GMT
Referrer-Policy: strict-origin-when-cross-origin
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Ratelimit-Limit: -1
X-Ratelimit-Remaining: -1
X-Ratelimit-Reset: 1559582945
X-Xss-Protection: 1; mode=block
[{"reportItemType":"ERROR","message":"Serial number is not valid","entity":"","line":0,"column":0}]
---------------------------------------------: timestamp="2025-06-11T13:42:25.922+0300"
2025-06-11T13:42:25.980+0300 [INFO] provider.terraform-provider-dcnm_v1.2.7.exe: 2025/06/11 13:42:25 [DEBUG] Ending Do method https://<ndfc_url>/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/interface?serialNumber=null&ifName=Ethernet1/3: timestamp="2025-06-11T13:42:25.975+0300"
2025-06-11T13:42:25.982+0300 [ERROR] vertex "import dcnm_interface.eth_ports result" error: Serial number is not valid
2025-06-11T13:42:25.993+0300 [ERROR] vertex "dcnm_interface.eth_ports (import id "ethernet:FDO******HJ:Ethernet1/3:LAN-FABRIC-P3")" error: Serial number is not valid
2025-06-11T13:42:25.993+0300 [ERROR] vertex "dcnm_interface.eth_ports (expand)" error: Serial number is not valid
╷
│ Error: Serial number is not valid
│
output of data "dcnm_inventory" "switch":
switch = {
+ deploy = true
+ fabric_name = "LAN-FABRIC-03"
+ id = "10...11"
+ ip = "10...11"
+ mode = "Normal"
+ model = "N9K-C93240YC-FX2"
+ role = "leaf"
+ serial_number = "FDOHJ"
+ switch_db_id = "380"
+ switch_name = "LEAF*******01-01"
}