Skip to content

Commit c41d7c3

Browse files
authored
feat(examples/templates/kubernetes-devcontainer): switch code-server to a module and add JetBrains (coder#15545)
1 parent 5786a13 commit c41d7c3

File tree

1 file changed

+31
-20
lines changed
  • examples/templates/kubernetes-devcontainer

1 file changed

+31
-20
lines changed

examples/templates/kubernetes-devcontainer/main.tf

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,7 @@ resource "coder_agent" "main" {
334334
startup_script = <<-EOT
335335
set -e
336336
337-
# Install the latest code-server.
338-
# Append "--version x.x.x" to install a specific version of code-server.
339-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
340-
341-
# Start code-server in the background.
342-
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
337+
# Add any commands that should be executed at workspace startup (e.g install requirements, start a program, etc) here
343338
EOT
344339
dir = "/workspaces"
345340

@@ -421,20 +416,36 @@ resource "coder_agent" "main" {
421416
}
422417
}
423418

424-
resource "coder_app" "code-server" {
425-
agent_id = coder_agent.main.id
426-
slug = "code-server"
427-
display_name = "code-server"
428-
url = "http://localhost:13337/?folder=/workspaces"
429-
icon = "/icon/code.svg"
430-
subdomain = false
431-
share = "owner"
432-
433-
healthcheck {
434-
url = "http://localhost:13337/healthz"
435-
interval = 5
436-
threshold = 6
437-
}
419+
# See https://registry.coder.com/modules/code-server
420+
module "code-server" {
421+
count = data.coder_workspace.me.start_count
422+
source = "registry.coder.com/modules/code-server/coder"
423+
424+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
425+
version = ">= 1.0.0"
426+
427+
agent_id = coder_agent.main.id
428+
order = 1
429+
}
430+
431+
# See https://registry.coder.com/modules/jetbrains-gateway
432+
module "jetbrains_gateway" {
433+
count = data.coder_workspace.me.start_count
434+
source = "registry.coder.com/modules/jetbrains-gateway/coder"
435+
436+
# JetBrains IDEs to make available for the user to select
437+
jetbrains_ides = ["IU", "PY", "WS", "PS", "RD", "CL", "GO", "RM"]
438+
default = "IU"
439+
440+
# Default folder to open when starting a JetBrains IDE
441+
folder = "/home/coder"
442+
443+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
444+
version = ">= 1.0.0"
445+
446+
agent_id = coder_agent.main.id
447+
agent_name = "main"
448+
order = 2
438449
}
439450

440451
resource "coder_metadata" "container_info" {

0 commit comments

Comments
 (0)