equinix / terraform-provider-equinix

Terraform Equinix provider
https://deploy.equinix.com/labs/terraform-provider-equinix/
MIT License
47 stars 45 forks source link

metal_device allow creation of spot device #161

Open colemickens opened 2 years ago

colemickens commented 2 years ago

Hi,

This is a feature request.

With the regular Metal Equinix API, it is possible to directly request a single machine. For my usage, this is a better API match. I generally am making a single one-off VM with a termination time. This would also make the process of getting the spot machine's IP address as an output attribute (whereas now there's seemingly no linkage between the spot_market_request and any actually instantiated instances (even with the wait_for_devices).

I think this would roughly constitute plumbing through these fields of the Create Device API:

    "spot_instance": "boolean",
    "spot_price_max": "number",
displague commented 1 year ago

The spot market request API creates batches of devices. We don't have a Terraform interface to the batch device request APIs today.

I wonder if this request would be closer fit as a parameter within a batch device request resource, or as a separate resource within designed in a way that we might design a batch device request resource:

resource "equinix_metal_device_batch" "batch" {
  devices = [{ device1 params }, { device2 params}]
  { ...batch params }
}

resource "equinix_metal_smr_devices" "spot" {
  devices = [{ device1 params }, { device2 params}]
  { ...spot params }
}

# or some combination
resource "equinix_metal_device_smr_ready_batch" "all_in_one" {
  devices = [{ device1 params }, { device2 params}]
  { ...batch params }
  { ...spot params }
}

If the devices are not returned in a predictable order, or if there is no way to map spot or batch created devices back to their 'request' or 'batch' object, this could be difficult to implement.

displague commented 1 year ago

Additional thoughts were captured earlier in https://github.com/equinix/terraform-provider-equinix/issues/200