You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have a Storage Zone and a Pull Zone defined in Terraform, renaming the Storage Zone causes a recreation operation. This creates a bit of a race condition when Terraform tries to delete a pull zone that has already been deleted automatically when the storage zone is deleted.
This function should be updated to succeed if a 404 is returned gracefully.
The issue is not necessarely on DeletePullzone, but rather on UpdatePullzone, as terraform is trying to change the storage zone associated in the pullzone, but the pullzone has already been deleted.
That happens because internally, when you delete the storage zone, the associated pullzone would have no origin anymore, so the historical behavior for the Bunny API is to delete the associated pullzone as well. If you'd like to rename the Storage Zone manually via dash.bunny.net, you'd have to create the new storage zone first, change the pullzone's origin, and then delete the old storage zone. Terraform does not offer a way to explicitly control the order of operations, and it also doesn't like when resources shift/disappear under its feet, hence the error.
Terraform only allows me to control its plan, so I could make it reflect what would happen in the API, by forcing the pullzone to be replaced when it's storage zone is changed. While this would fix your issue, re-creating the pullzone has one side-effect that its statistics will be gone, and you'd need two passes to remedy. In situations that you're explicitly changing the pullzone's origin from one storage zone to another (without deleting the original), it would also cause a replace, and there would be no workaround that doesn't involve multiple passes.
So I'm not exactly sure what to do. Either of "renaming the storage zone" or "changing the pullzone's origin storage" would have to happen in multiple passes, and I'm not sure which case is more common. For your particular case, the workaround would be:
Declare the new storage zone resource;
Change the pullzone's origin;
terraform apply;
Remove the old storage zone resource;
terraform apply
I'm open to suggestions on how to handle that gracefully, hopefully without multiple passes.
If I have a Storage Zone and a Pull Zone defined in Terraform, renaming the Storage Zone causes a recreation operation. This creates a bit of a race condition when Terraform tries to delete a pull zone that has already been deleted automatically when the storage zone is deleted.
This function should be updated to succeed if a 404 is returned gracefully.
terraform-provider-bunnynet/internal/api/pullzone.go
Line 242 in 522190f
Example TF output:
The text was updated successfully, but these errors were encountered: