CiscoDevNet / terraform-provider-meraki

Terraform Cisco Meraki Provider
https://registry.terraform.io/providers/CiscoDevNet/meraki
Mozilla Public License 2.0
4 stars 0 forks source link

Stp fix #17

Closed mcparaf closed 1 month ago

mcparaf commented 1 month ago

This is a workaround for weird API behavior when it comes to switch STP. The data is essentially a map where the key is the priority and the value is a tuple (stacks, switchProfiles, switches). But the API implements this as a list and sometimes returns multiple entries with the same priority which confuses the provider because it thinks that changes were made. In particular, the scenario that I have observed:

  1. posted a singular object with switches, profiles and stacks
  2. observed multiple objects returned with switches, profiles and stacks separately but the same priority
  3. provider thinks changes were made and there is an idempotency inconsistency

The fix essentially converts the whole input data into the map, merging all the data as necessary and only then exposes the data to Terraform. No changes were necessary when converting Terraform data to the API.