Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

deleting a device from a hardware reservation fails #199

Closed
displague opened this issue Nov 15, 2021 · 6 comments · Fixed by #200
Closed

deleting a device from a hardware reservation fails #199

displague opened this issue Nov 15, 2021 · 6 comments · Fixed by #200
Assignees
Labels
bug Something isn't working

Comments

@displague
Copy link
Member

displague commented Nov 15, 2021

Deleting a device created from a hardware reservation fails when wait_for_reservation_deprovision = "true" is set.

https://github.com/equinix/terraform-provider-metal/blob/main/metal/resource_metal_device.go#L781

The deployed_hardware_reservation_id should be used rather than the hardware_reservation_id.

As a fall-back, if deployed_hardware_reservation_id is not set, we could consider deleting by hardware_reservation_id so long as it is not set to next-available. If implemented, this would need to be prepared for a 404. One reason not to implement this fall-back behavior is that a reservation consumed outside of this TF config could be incorrectly deleted. Users wanting to clean up a metal_device that lacks deployed_hardware_reservation_id in this case should import the metal_device (consuming the reservation) first, before attempting to delete it.

@displague
Copy link
Member Author

It would be helpful to test device deletion with reservations to prevent this in the future. The resources for doing so in E2E testing would incur costly and parallelization constraints. A mock creation and deletion could be beneficial for testing this behavior.

@displague displague added the bug Something isn't working label Nov 15, 2021
@displague
Copy link
Member Author

The tell-tale logging sign that this bug is being encountered is:

GET /metal/v1/hardware-reservations/next-available HTTP/1.1
│ Error: Not found

@enkelprifti98
Copy link

enkelprifti98 commented Nov 15, 2021

Just want to clarify here that this issue only happens when wait_for_reservation_deprovision = "true" is set for a metal_device resource. Otherwise deleting reserved instances works fine.

@displague
Copy link
Member Author

thanks @enkelprifti98 - I updated the description.

@t0mk
Copy link
Contributor

t0mk commented Nov 19, 2021

@displague @enkelprifti98 I will take a look.

@displague
Copy link
Member Author

Fix released in v3.2.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
3 participants