Skip to content

fix(instance): server: fix deletions in private_network list#3783

Draft
Mia-Cross wants to merge 3 commits intoscaleway:mainfrom
Mia-Cross:instance_server_fix_private_networks
Draft

fix(instance): server: fix deletions in private_network list#3783
Mia-Cross wants to merge 3 commits intoscaleway:mainfrom
Mia-Cross:instance_server_fix_private_networks

Conversation

@Mia-Cross
Copy link
Contributor

We noticed unexpected behaviors in the private_network list attribute of the scaleway_instance_server resource.

  • When we switch the order of 2 pn_ids in the list, both get removed.
  • When deleting 2 pn_ids out of a list of 4, only 1 PN remains.

Notes:

  • For now, I attempted to turn the TypeList into a TypeSet, which solved the first part of the test (the ordering problem), but introduces phantom private networks (elements with only the computed attributes set, but pn_id empty) in the second part: when deleting 2 pn_ids out of 4, there are actually 3 PNs that are read from the user config by Terraform (including 1 phantom pn), then 4 again (2 phantoms) when checking resource attributes values.
  • Using sets is tricky for this attribute because, originally, the hash is calculated with all attributes of the element, which means that, on create, the element's hash will be based only on pn_id, but when reading the computed attributes, the element has new values inside and the hash changes. I attempted to avoid this by having a custom hash func that only considers the pn_id, but this seems to be what's generating the phantom elements.

@Mia-Cross Mia-Cross self-assigned this Mar 11, 2026
@Mia-Cross Mia-Cross added bug instance Instance issues, bugs and feature requests labels Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug instance Instance issues, bugs and feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant