cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
332
Views
1
Helpful
1
Replies

Interface configuration on the Nexus 9300 via Terraform

I am unable to configure the Ethernet1/10 interface on the Nexus 9300 via Terraform. My configuration:

main.tf:

terraform {
required_providers {
nxos = {
source = "CiscoDevNet/nxos"
version = "0.5.3"
}
}
}

provider "nxos" {
username = var.nxos_username
password = var.nxos_password
url = var.nxos_url
}

resource "nxos_ipv4_interface" "configure_interface_nxos" {
vrf = "default"
interface_id = "Ethernet1/10"
}

resource "nxos_ipv4_interface_address" "configure_interface_nxos" {
depends_on = [nxos_ipv4_interface.configure_interface_nxos]
vrf = "default"
interface_id = "Ethernet1/10"
address = "${var.ip_address}/${var.mask}"
}

variables.tf:

variable "nxos_username" {
type = string
}
variable "nxos_password" {
type = string
}
variable "nxos_url" {
type = string
}
variable "ip_address" {
type = string
}
variable "mask" {
type = string
}

terraform.tfvars:

nxos_username = "admin"
nxos_password = "admin"
nxos_url = "https://10.10.10.10"
ip_address = "192.168.5.5"
mask = "255.255.255.0"

Error:

 

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following
symbols:
+ create

Terraform will perform the following actions:

# nxos_ipv4_interface.configure_interface_nxos will be created
+ resource "nxos_ipv4_interface" "configure_interface_nxos" {
+ drop_glean = "disabled"
+ forward = "disabled"
+ id = (known after apply)
+ interface_id = "Ethernet1/10"
+ unnumbered = "unspecified"
+ urpf = "disabled"
+ vrf = "default"
}

# nxos_ipv4_interface_address.configure_interface_nxos will be created
+ resource "nxos_ipv4_interface_address" "configure_interface_nxos" {
+ address = "192.168.5.5/255.255.255.0"
+ id = (known after apply)
+ interface_id = "Ethernet1/10"
+ type = "primary"
+ vrf = "default"
}

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

nxos_ipv4_interface.configure_interface_nxos: Creating...
╷
│ Error: Client Error
│
│ with nxos_ipv4_interface.configure_interface_nxos,
│ on main.tf line 16, in resource "nxos_ipv4_interface" "configure_interface_nxos":
│ 16: resource "nxos_ipv4_interface" "configure_interface_nxos" {
│
│ Failed to post object, got error: JSON error: {"imdata":[{"error": {"attributes": {"code": "104","text": "Invalid interface name:
│ Ethernet1\/10, error: -1: FAILED TO PARSE PROP id of class ipv4If\n: Invalid RN if-[Ethernet1\/10]"}}}]}

 

 

1 Accepted Solution

Accepted Solutions

The error message indicates that the interface name "Ethernet1/10" is invalid. Try changing the interface_id in your Terraform configuration to "Eth1/10" instead of "Ethernet1/10".

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

View solution in original post

1 Reply 1

The error message indicates that the interface name "Ethernet1/10" is invalid. Try changing the interface_id in your Terraform configuration to "Eth1/10" instead of "Ethernet1/10".

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io