Closed akinross closed 4 months ago
Hi @akinross . The issue itself seems to be fixed as now the resource is updated-in-place instead of destroyed-recreating. But adding a new port to the list now re-orders the list, showing an update to every single entry on the bulk. Im guessing this is due to some sort() or ordering of the data when being written to the state. It technically doesnt affect the resource being applied, but it would be nice to get the "real" change instead of a re-ordering of all paths:
# module.tf-aci-ndo-staticports.mso_schema_site_anp_epg_bulk_staticport.accessPortsL2_bulk["TENANT-server-03-EPG-ACI"] will be updated in-place
~ resource "mso_schema_site_anp_epg_bulk_staticport" "accessPortsL2_bulk" {
id = "/site//template/Strchd-L2-Template/anp/server-AP/epg/server-03-EPG"
# (5 unchanged attributes hidden)
~ static_ports {
~ path = "eth1/3" -> "eth1/20"
# (8 unchanged attributes hidden)
}
~ static_ports {
~ path = "eth1/4" -> "eth1/3"
# (8 unchanged attributes hidden)
}
~ static_ports {
~ path = "eth1/5" -> "eth1/4"
# (8 unchanged attributes hidden)
}
~ static_ports {
~ path = "eth1/6" -> "eth1/5"
# (8 unchanged attributes hidden)
}
~ static_ports {
~ path = "eth1/7" -> "eth1/6"
# (8 unchanged attributes hidden)
}
~ static_ports {
~ path = "eth1/8" -> "eth1/7"
# (8 unchanged attributes hidden)
}
~ static_ports {
~ path = "eth1/9" -> "eth1/8"
# (8 unchanged attributes hidden)
}
+ static_ports {
+ deployment_immediacy = "lazy"
+ leaf = "1001"
+ micro_seg_vlan = 0
+ mode = "regular"
+ path = "eth1/9"
+ path_type = "port"
+ pod = "pod-1"
+ vlan = 2002
}
On this output, the new port in the configuration is the 1/20. The 1/9 is already configured, but due to the re-ordering on the state, is being shown as a new one.
@edudppaz Akini is on leave and will be back soon!
The reason you are seeing this behaviour is because static_ports is defined as TypeList in the resource which makes Terraform treat static_ports as ordered collections. This means that the order of items in a list is significant and any change in the order of items is considered a change to the list itself.
A way to get around this would be to use TypeSet for the said attribute but it comes with its own cosmetic quirks.
… updating the list
fixes #270