CiscoDevNet / terraform-provider-nxos

Terraform Cisco NX-OS Provider
https://registry.terraform.io/providers/netascode/nxos
Mozilla Public License 2.0
9 stars 10 forks source link

0.4.1 causing token/auth errors #140

Closed mobig closed 1 year ago

mobig commented 1 year ago

Using the following script on the version 0.4.1, i'm getting auth errors. here is the script i'm using:

terraform {
  required_providers {
    nxos = {
      source  = "netascode/nxos"
      version = "0.4.1"
    }
  }
}

provider "nxos" {
  username = "admin"
  password = "<pw>"
  devices  = local.switches
}

locals {
  switches = [
    {
      name         = "switch_1"
      url          = "https://192.168.0.154"
      vrf          = "default"
      prefix       = "11.11.11.0/24"
      interface_id = "unspecified"
      address      = "5.2.2.2"
    },
    {
      name         = "switch_2"
      url          = "https://192.168.0.155"
      vrf          = "default"
      prefix       = "11.12.11.0/24"
      interface_id = "unspecified"
      address      = "5.2.2.1"
    }
  ]
}

resource "nxos_ipv4_static_route" "example" {
  for_each  = {for device in local.switches : device.name => device}
  device    = each.value.name
  vrf_name  = each.value.vrf
  prefix    = each.value.prefix
  next_hops = [
    {
      interface_id = each.value.interface_id
      address      = each.value.address
      vrf_name     = each.value.vrf
      description  = "My Description"
    }
  ]
}

And here is the error i'm seeing:

│ Error: Client Error
│
│   with nxos_ipv4_static_route.example["switch_2"],
│   on main.tf line 38, in resource "nxos_ipv4_static_route" "example":
│   38: resource "nxos_ipv4_static_route" "example" {
│
│ Failed to retrieve object, got error: JSON error: {"imdata":[{"error": {"attributes": {"code": "403","text": "Need a valid webtoken cookie (named APIC-Cookie) or a signed request with signature in the cookie APIC-Request-Signature for all REST API requests"}}}]}
╵

I don't get auth errors when downgrading to 0.4.0

mobig commented 1 year ago

@danischm Any thoughts on what might be causing this?

danischm commented 1 year ago

Apologies for the long delay, as I have been away. Issue should be fixed in 0.4.2.