Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Devices/Resources/mist_org_deviceprofile_assign #70

Open
nunopp opened this issue Jan 6, 2025 · 3 comments
Open

Error in Devices/Resources/mist_org_deviceprofile_assign #70

nunopp opened this issue Jan 6, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@nunopp
Copy link

nunopp commented Jan 6, 2025

Describe the bug

When using a dynamic string list for attribute "macs" where index values dynamicaly change it produces an error when executing apply, however the deviceprofile assigment to the respective devices mac address are executed

To Reproduce

Steps to reproduce the behavior:

  1. Create, update or refresh '.....' resource or datasource
  2. Configure the resource/datasource with the following HCL configuration (paste the HCL configuration, remove any sensitive information)
  3. Use Terraform Apply / Refresh / ... command
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Error Message

Error: Provider produced inconsistent result after apply

When applying changes to mist_org_deviceprofile_assign.deviceprofile_ap_45_assign, provider "provider["registry.terraform.io/juniper/mist"]" produced an unexpected new value: .macs[1]: was
cty.StringVal("7090410295d1"), but now cty.StringVal("7090410296ad").

This is a bug in the provider, which should be reported in the provider's own issue tracker.

Software

  • OS: Windows
  • Terraform Version [e.g. v1.9.7]
  • Provider Version [e.g. v0.2.6]

Additional context

Add any other context about the problem here.

@nunopp nunopp added the bug Something isn't working label Jan 6, 2025
@tmunzer
Copy link
Collaborator

tmunzer commented Jan 6, 2025

Hi @nunopp,
This may be because the macs attribute is a "List" (ordered). I can try to change it to a "Set" (unordered).
Currently the processing of the response tries to keep the same order between the plan and the state (Mist can change the macs order in the response), but it seems this approach is not working in your case.

Can you just explain how do you generate the "dynamic string list"?

Thanks

@nunopp
Copy link
Author

nunopp commented Jan 6, 2025

Hi @tmunzer, yes it sounds that the order is changing, I think that is because I use this to enable or not the devices that use this device profile, I'm using a csv file (which is the device mac address inventory) to then include or not the mac address for this field (DP = device profile)
ap_inventory = csvdecode(local.csv_data)
DP_list = [for item in local.ap_inventory : item["DP"]]
then inside the resource > macs = local.DP_list

Thanks

@tmunzer
Copy link
Collaborator

tmunzer commented Jan 6, 2025

Thanks for the information.
I'll try on my side, and if needed I'll change macs type from List to Set (it should not require any change on your side).

tmunzer added a commit that referenced this issue Jan 7, 2025
fir for #70
in some condition the assigned/unassigned devices process may fail on the Mist side, and the list of MAC addresses returned may not match what is expected. This case was not processed by the provider, resulting a "This is a bug in the provider, which should be reported in the provider's own issue tracker." error message.
The provider is now returning a specific warning when it was not able to unassign a device, and a specific error when it was not able to assign a device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants