Juniper / terraform-provider-apstra

Apstra Terraform Provider
Apache License 2.0
16 stars 2 forks source link

Handle case where `bindings` are removed from vn resource #921

Closed chrismarget-j closed 1 month ago

chrismarget-j commented 1 month ago

I think that a user creating a VN with bindings, then deleting those bindings (possible with 5.x) will find that the bindings do not go away.

This is consistent with terraform's "I don't care about that value" approach, but puts us in a tough position when no bindings are found during Read(). Do we return bindings = null or bindings = {}?

Possible workarounds:

chrismarget-j commented 1 month ago

It looks like the current strategy (note presence of bindings in the state) solves this problem:

https://github.com/Juniper/terraform-provider-apstra/blob/ffca27533382aff6c48229444fb61f560e0601f4/apstra/resource_datacenter_virtual_network.go#L294C1-L304C1