terraform-google-modules/terraform-google-vm

Add support for spot instances

jawnsy opened this issue · 8 comments

TL;DR

This module supports preemptible instances, but not spot instances

Terraform Resources

We should be able to use provisioning_model = SPOT to support spot instances: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance_template#nested_scheduling

Detailed design

Add a "spot" variable in the model and set the provisioning_model here:

# scheduling must have automatic_restart be false when preemptible is true.
scheduling {
preemptible = var.preemptible
automatic_restart = !var.preemptible
on_host_maintenance = local.on_host_maintenance
}

Additional information

No response

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

I believe this is still a valid issue

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

This is still a valid issue