Skip to content

Commit 9c15087

Browse files
committed
Merge branch 'main' of github.com:VectorInstitute/aieng-platform
2 parents 24962f2 + e9d41ff commit 9c15087

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

coder/deploy/main.tf

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,19 @@ resource "google_compute_health_check" "tcp_check" {
105105
}
106106
}
107107

108+
# Create a persistent boot disk for the VM
109+
resource "google_compute_disk" "vm_boot_disk" {
110+
name = "${var.vm_name}-boot-disk"
111+
type = "pd-standard"
112+
zone = var.zone
113+
image = "ubuntu-2204-lts"
114+
size = 20
115+
116+
lifecycle {
117+
prevent_destroy = true
118+
}
119+
}
120+
108121
# Create the compute instance
109122
resource "google_compute_instance" "server" {
110123
name = var.vm_name
@@ -115,9 +128,8 @@ resource "google_compute_instance" "server" {
115128
allow_stopping_for_update = true
116129

117130
boot_disk {
118-
initialize_params {
119-
image = "ubuntu-2204-lts"
120-
}
131+
source = google_compute_disk.vm_boot_disk.id
132+
auto_delete = false # Important: Prevents disk deletion with VM
121133
}
122134

123135
network_interface {

0 commit comments

Comments
 (0)