Skip to content

Commit d07ebf8

Browse files
committed
add: code-server to gcp-linux template
1 parent e5f302f commit d07ebf8

File tree

1 file changed

+21
-5
lines changed
  • examples/templates/gcp-linux

1 file changed

+21
-5
lines changed

examples/templates/gcp-linux/main.tf

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ terraform {
66
}
77
google = {
88
source = "hashicorp/google"
9-
version = "~> 4.34.0"
9+
version = "~> 4.15"
1010
}
1111
}
1212
}
@@ -39,16 +39,32 @@ resource "google_compute_disk" "root" {
3939
name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}-root"
4040
type = "pd-ssd"
4141
zone = var.zone
42-
image = "debian-cloud/debian-11"
42+
image = "debian-cloud/debian-10"
4343
lifecycle {
4444
ignore_changes = [image]
4545
}
4646
}
4747

4848
resource "coder_agent" "main" {
49-
auth = "google-instance-identity"
50-
arch = "amd64"
51-
os = "linux"
49+
auth = "google-instance-identity"
50+
arch = "amd64"
51+
os = "linux"
52+
startup_script = <<EOT
53+
#!/bin/bash
54+
55+
# install and start code-server
56+
curl -fsSL https://code-server.dev/install.sh | sh | tee code-server-install.log
57+
code-server --auth none --port 13337 | tee code-server-install.log &
58+
EOT
59+
}
60+
61+
# code-server
62+
resource "coder_app" "code-server" {
63+
agent_id = coder_agent.main.id
64+
name = "code-server"
65+
icon = "/icon/code.svg"
66+
url = "http://localhost:13337?folder=/home/coder"
67+
relative_path = true
5268
}
5369

5470
resource "google_compute_instance" "dev" {

0 commit comments

Comments
 (0)