From 68dc820a7c4f7e18cff507a7f58e5b2b8905c86c Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:23:36 +0100 Subject: [PATCH] feat(examples/templates/devcontainer-docker): promote module usage (#15544) --- .../templates/devcontainer-docker/main.tf | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/examples/templates/devcontainer-docker/main.tf b/examples/templates/devcontainer-docker/main.tf index 7b38608e10..e34a70554c 100644 --- a/examples/templates/devcontainer-docker/main.tf +++ b/examples/templates/devcontainer-docker/main.tf @@ -239,12 +239,7 @@ resource "coder_agent" "main" { startup_script = <<-EOT set -e - # Install the latest code-server. - # Append "--version x.x.x" to install a specific version of code-server. - curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server - - # Start code-server in the background. - /tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 & + # Add any commands that should be executed at workspace startup (e.g install requirements, start a program, etc) here EOT dir = "/workspaces" @@ -326,20 +321,36 @@ resource "coder_agent" "main" { } } -resource "coder_app" "code-server" { - agent_id = coder_agent.main.id - slug = "code-server" - display_name = "code-server" - url = "http://localhost:13337/?folder=/workspaces" - icon = "/icon/code.svg" - subdomain = false - share = "owner" +# See https://registry.coder.com/modules/code-server +module "code-server" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/modules/code-server/coder" - healthcheck { - url = "http://localhost:13337/healthz" - interval = 5 - threshold = 6 - } + # This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production. + version = ">= 1.0.0" + + agent_id = coder_agent.main.id + order = 1 +} + +# See https://registry.coder.com/modules/jetbrains-gateway +module "jetbrains_gateway" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/modules/jetbrains-gateway/coder" + + # JetBrains IDEs to make available for the user to select + jetbrains_ides = ["IU", "PY", "WS", "PS", "RD", "CL", "GO", "RM"] + default = "IU" + + # Default folder to open when starting a JetBrains IDE + folder = "/home/coder" + + # This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production. + version = ">= 1.0.0" + + agent_id = coder_agent.main.id + agent_name = "main" + order = 2 } resource "coder_metadata" "container_info" {