Skip to content

Commit 68dc820

Browse files
authored
feat(examples/templates/devcontainer-docker): promote module usage (#15544)
1 parent 56c792a commit 68dc820

File tree

1 file changed

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

1 file changed

+31
-20
lines changed

examples/templates/devcontainer-docker/main.tf

+31-20
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,7 @@ resource "coder_agent" "main" {
239239
startup_script = <<-EOT
240240
set -e
241241
242-
# Install the latest code-server.
243-
# Append "--version x.x.x" to install a specific version of code-server.
244-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
245-
246-
# Start code-server in the background.
247-
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
242+
# Add any commands that should be executed at workspace startup (e.g install requirements, start a program, etc) here
248243
EOT
249244
dir = "/workspaces"
250245

@@ -326,20 +321,36 @@ resource "coder_agent" "main" {
326321
}
327322
}
328323

329-
resource "coder_app" "code-server" {
330-
agent_id = coder_agent.main.id
331-
slug = "code-server"
332-
display_name = "code-server"
333-
url = "http://localhost:13337/?folder=/workspaces"
334-
icon = "/icon/code.svg"
335-
subdomain = false
336-
share = "owner"
337-
338-
healthcheck {
339-
url = "http://localhost:13337/healthz"
340-
interval = 5
341-
threshold = 6
342-
}
324+
# See https://registry.coder.com/modules/code-server
325+
module "code-server" {
326+
count = data.coder_workspace.me.start_count
327+
source = "registry.coder.com/modules/code-server/coder"
328+
329+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
330+
version = ">= 1.0.0"
331+
332+
agent_id = coder_agent.main.id
333+
order = 1
334+
}
335+
336+
# See https://registry.coder.com/modules/jetbrains-gateway
337+
module "jetbrains_gateway" {
338+
count = data.coder_workspace.me.start_count
339+
source = "registry.coder.com/modules/jetbrains-gateway/coder"
340+
341+
# JetBrains IDEs to make available for the user to select
342+
jetbrains_ides = ["IU", "PY", "WS", "PS", "RD", "CL", "GO", "RM"]
343+
default = "IU"
344+
345+
# Default folder to open when starting a JetBrains IDE
346+
folder = "/home/coder"
347+
348+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
349+
version = ">= 1.0.0"
350+
351+
agent_id = coder_agent.main.id
352+
agent_name = "main"
353+
order = 2
343354
}
344355

345356
resource "coder_metadata" "container_info" {

0 commit comments

Comments
 (0)