Skip to content

Commit 6b1fafb

Browse files
authored
feat(examples/templates/aws-linux): use modules for code-server and jetbrains (coder#15500)
1 parent b961776 commit 6b1fafb

File tree

1 file changed

+30
-20
lines changed
  • examples/templates/aws-linux

1 file changed

+30
-20
lines changed

examples/templates/aws-linux/main.tf

+30-20
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,7 @@ resource "coder_agent" "dev" {
164164
startup_script = <<-EOT
165165
set -e
166166
167-
# Install the latest code-server.
168-
# Append "--version x.x.x" to install a specific version of code-server.
169-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
170-
171-
# Start code-server in the background.
172-
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
167+
# Add any commands that should be executed at workspace startup (e.g install requirements, start a program, etc) here
173168
EOT
174169

175170
metadata {
@@ -195,21 +190,36 @@ resource "coder_agent" "dev" {
195190
}
196191
}
197192

198-
resource "coder_app" "code-server" {
199-
count = data.coder_workspace.me.start_count
200-
agent_id = coder_agent.dev[0].id
201-
slug = "code-server"
202-
display_name = "code-server"
203-
url = "http://localhost:13337/?folder=/home/coder"
204-
icon = "/icon/code.svg"
205-
subdomain = false
206-
share = "owner"
193+
# See https://registry.coder.com/modules/code-server
194+
module "code-server" {
195+
count = data.coder_workspace.me.start_count
196+
source = "registry.coder.com/modules/code-server/coder"
207197

208-
healthcheck {
209-
url = "http://localhost:13337/healthz"
210-
interval = 3
211-
threshold = 10
212-
}
198+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
199+
version = ">= 1.0.0"
200+
201+
agent_id = coder_agent.dev[0].id
202+
order = 1
203+
}
204+
205+
# See https://registry.coder.com/modules/jetbrains-gateway
206+
module "jetbrains_gateway" {
207+
count = data.coder_workspace.me.start_count
208+
source = "registry.coder.com/modules/jetbrains-gateway/coder"
209+
210+
# JetBrains IDEs to make available for the user to select
211+
jetbrains_ides = ["IU", "PY", "WS", "PS", "RD", "CL", "GO", "RM"]
212+
default = "IU"
213+
214+
# Default folder to open when starting a JetBrains IDE
215+
folder = "/home/coder"
216+
217+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
218+
version = ">= 1.0.0"
219+
220+
agent_id = coder_agent.dev[0].id
221+
agent_name = "dev"
222+
order = 2
213223
}
214224

215225
locals {

0 commit comments

Comments
 (0)