terraform-provider-iosxe icon indicating copy to clipboard operation
terraform-provider-iosxe copied to clipboard

Error: Value Conversion Error

Open stevenca opened this issue 7 months ago • 14 comments

stevenca@STEVENCA-M-4RY2 wireless % terraform plan

│ Error: Value Conversion Error
│ 
│   with module.wlc.iosxe_restconf.nested_list,
│   on wlc/main.tf line 64, in resource "iosxe_restconf" "nested_list":
│   64: resource "iosxe_restconf" "nested_list" {
│ 
│ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:
│ 
│ Received unknown value, however the target type cannot handle unknown values. Use the corresponding `types` package type or a custom type that handles unknown
│ values.
│ 
│ Path: lists[0].items
│ Target Type: []basetypes.MapValue
│ Suggested Type: basetypes.ListValue

This is the block it has issues with:

resource "iosxe_restconf" "nested_list" {
  path = "Cisco-IOS-XE-wireless-wlan-cfg:wlan-cfg-data/wlan-cfg-entries"
  lists = [{
    name = "wlan-cfg-entry"
    key  = "profile-name"
    items = [
      for idx, ssid in var.cfg.ssids : {
        "profile-name"                  = try(ssid.profile, ssid.name)
        "wlan-id"                       = ssid.number  # Auto-increment WLAN ID starting from 1
        "auth-key-mgmt-psk"             = try(ssid.auth_psk, true)    # Default to true if not specified
        "auth-key-mgmt-dot1x"           = try(ssid.auth_dot1x, false) # Default to false if not specified
        "psk"                           = ssid.psk
        "apf-vap-id-data/ssid"          = ssid.name
        "apf-vap-id-data/wlan-status"   = try(ssid.status, true) # Default to true if not specified
      }
    ]
  }]
}

This cropped up between 0.5.6 and 0.5.9. Is it my code or an issue in the provider?

Thanks,

Steven.

stevenca avatar Mar 27 '25 19:03 stevenca