I am trying to implement spot instance option in google cloud.
As part of that, I tried using the documentation in this link: google_compute_instance | Resources | hashicorp/google | Terraform Registry
provider "google" {
credentials = file("service-account.json")
project = "project1"
region = "us-central1"
zone = "us-central1-c"
}
resource "google_compute_instance" "vm_instance" {
name = "terraform-instance"
machine_type = "f1-micro"
boot_disk {
initialize_params {
image = "debian-cloud/debian-9"
}
}
network_interface {
network = google_compute_network.vpc_network.self_link
}
scheduling {
provisioning_model = SPOT
preemptible = true
#auto_restart = false
}
}
resource "google_compute_network" "vpc_network" {
name = "terraform-network"
auto_create_subnetworks = "true"
}
But getting below error.
╷
│ Error: Unsupported argument
│
│ 22: provisioning_model = SPOT
│
│ An argument named "provisioning_model" is not expected
│ here.
╵
╷
│ Error: Unsupported argument
│
│ on main.tf line 24, in resource "google_compute_instance" "vm_instance":
│ 24: auto_restart = false
│
│ An argument named "auto_restart" is not expected here.
╵
PS C:\Users\adminuser\Desktop\gke> terraform apply -auto-approve
╷
│ Error: Unsupported argument
│
│ on main.tf line 22, in resource "google_compute_instance" "vm_instance":
│ 22: provisioning_model = SPOT
│
│ An argument named "provisioning_model" is not expected
│ here.