Prior to this PR, the equinix_metal_device resource would explicity remove a device from state and produce a custom error message if the device reached failed status during provisioning. That logic was introduced 5 years ago in packethost/terraform-provider-packet#175 in order to provide a better experience for devices that fail to provision.
This removes the call explicitly drop a Metal device from state if it is in any state other than active after provisioning, keeping the custom error message. The only time we should automatically drop a Metal device from state is if we can reasonably assume that the device no longer exists (i.e., we got either a 403 or a 404).
This change makes it possible for terraform to automatically clean up after itself when a Metal device fails to provision but the device still exists. Due to built-in, unmodifiable Terraform behavior, the resource will automatically be tainted, which will cause it to be deleted and recreated on the next Terraform run. In cases where the device times out during provisioning but still provisions successfully, this change also gives users an opportunity to manually untaint the existing device and proceed as normal, rather than having to either manually delete the device outside of terraform or import the device into terraform state.
Prior to this PR, the
equinix_metal_device
resource would explicity remove a device from state and produce a custom error message if the device reachedfailed
status during provisioning. That logic was introduced 5 years ago in packethost/terraform-provider-packet#175 in order to provide a better experience for devices that fail to provision.This removes the call explicitly drop a Metal device from state if it is in any state other than
active
after provisioning, keeping the custom error message. The only time we should automatically drop a Metal device from state is if we can reasonably assume that the device no longer exists (i.e., we got either a 403 or a 404).This change makes it possible for terraform to automatically clean up after itself when a Metal device fails to provision but the device still exists. Due to built-in, unmodifiable Terraform behavior, the resource will automatically be tainted, which will cause it to be deleted and recreated on the next Terraform run. In cases where the device times out during provisioning but still provisions successfully, this change also gives users an opportunity to manually untaint the existing device and proceed as normal, rather than having to either manually delete the device outside of terraform or import the device into terraform state.
Closes #793