Resource state not refreshed before destroy #35568
Labels
bug
new
new issue not yet triaged
waiting for reproduction
unable to reproduce issue without further information
We maintain a terraform provider that is failing to delete a "primary IP" resource in certain circumstances.
Before we can delete a primary IP resource, we have to unassign it from a server instance in our API.
During our tests of the delete call, we noticed that the state of the primary IP resource references an invalid server instance. This led to try to unassign the primary IP from an instance that was not assigned. Which made the primary IP resource deletion fail.
That bug is only happening in terraform >=1.9, so we ran a git bisect from the last known terraform version to work (1.8.5). We found the problematic commit to be 460c7f3 #35467
Reverting that commit on top of the v1.9 branch fixes our issue.
Terraform Version
Terraform Configuration Files
On https://github.com/hetznercloud/terraform-provider-hcloud/tree/tf-1.9-primary-ip-delete
Debug Output
Traces: https://github.com/hetznercloud/terraform-provider-hcloud/blob/tf-1.9-primary-ip-delete/debug/test-TestServerResource_PrimaryIPTests.log
Actual Behavior
The state of the primary IP resource references an invalid server instance. Which led to try to unassign the primary IP from an instance that was not assigned. Which made the primary IP resource deletion fail.
Expected Behavior
We expect the state of the primary IP resource to be refreshed before we can destroy it.
Steps to Reproduce
Additional Context
References
The text was updated successfully, but these errors were encountered: