46 lines
905 B
Terraform
46 lines
905 B
Terraform
|
data "google_compute_image" "image" {
|
||
|
family = "common-cu113-debian-10"
|
||
|
project = "deeplearning-platform-release"
|
||
|
}
|
||
|
|
||
|
resource "google_compute_instance" "server" {
|
||
|
name = "ml-server"
|
||
|
#machine_type = "f1-micro"
|
||
|
machine_type = var.machine_type
|
||
|
zone = var.zone
|
||
|
|
||
|
tags = ["ml", "gpu"]
|
||
|
|
||
|
guest_accelerator {
|
||
|
type = var.guest_accelerator
|
||
|
count = 1
|
||
|
}
|
||
|
|
||
|
boot_disk {
|
||
|
initialize_params {
|
||
|
image = data.google_compute_image.image.self_link
|
||
|
# image = "debian-cloud/debian-10"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Local SSD disk
|
||
|
scratch_disk {
|
||
|
interface = "SCSI"
|
||
|
}
|
||
|
|
||
|
network_interface {
|
||
|
network = "default"
|
||
|
|
||
|
access_config {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
scheduling {
|
||
|
on_host_maintenance = "TERMINATE"
|
||
|
}
|
||
|
|
||
|
#metadata_startup_script = file("${path.module}/startup_script.sh")
|
||
|
metadata_startup_script = templatefile("${path.module}/startup_script.sh", var.startup_script_vars)
|
||
|
|
||
|
}
|