06-25-2024 05:06 AM
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]"}}}]}
Solved! Go to Solution.
06-25-2024 07:36 AM
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".
06-25-2024 07:36 AM
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".
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide