Skip to content

Commit 8a40817

Browse files
authored
feat(examples/templates/kubernetes-envbox): promote module usage (coder#15548)
1 parent 155cb07 commit 8a40817

File tree

1 file changed

+32
-23
lines changed
  • examples/templates/kubernetes-envbox

1 file changed

+32
-23
lines changed

examples/templates/kubernetes-envbox/main.tf

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ variable "use_kubeconfig" {
3434
EOF
3535
}
3636

37-
provider "coder" {
38-
}
37+
provider "coder" {}
3938

4039
variable "namespace" {
4140
type = string
@@ -95,30 +94,40 @@ resource "coder_agent" "main" {
9594
cp /etc/skel/.bashrc $HOME
9695
fi
9796
98-
# Install the latest code-server.
99-
# Append "--version x.x.x" to install a specific version of code-server.
100-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
101-
102-
# Start code-server in the background.
103-
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
97+
# Add any commands that should be executed at workspace startup (e.g install requirements, start a program, etc) here
10498
EOT
10599
}
106100

107-
# code-server
108-
resource "coder_app" "code-server" {
109-
agent_id = coder_agent.main.id
110-
slug = "code-server"
111-
display_name = "code-server"
112-
icon = "/icon/code.svg"
113-
url = "http://localhost:13337?folder=/home/coder"
114-
subdomain = false
115-
share = "owner"
116-
117-
healthcheck {
118-
url = "http://localhost:13337/healthz"
119-
interval = 3
120-
threshold = 10
121-
}
101+
# See https://registry.coder.com/modules/code-server
102+
module "code-server" {
103+
count = data.coder_workspace.me.start_count
104+
source = "registry.coder.com/modules/code-server/coder"
105+
106+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
107+
version = ">= 1.0.0"
108+
109+
agent_id = coder_agent.main.id
110+
order = 1
111+
}
112+
113+
# See https://registry.coder.com/modules/jetbrains-gateway
114+
module "jetbrains_gateway" {
115+
count = data.coder_workspace.me.start_count
116+
source = "registry.coder.com/modules/jetbrains-gateway/coder"
117+
118+
# JetBrains IDEs to make available for the user to select
119+
jetbrains_ides = ["IU", "PY", "WS", "PS", "RD", "CL", "GO", "RM"]
120+
default = "IU"
121+
122+
# Default folder to open when starting a JetBrains IDE
123+
folder = "/home/coder"
124+
125+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
126+
version = ">= 1.0.0"
127+
128+
agent_id = coder_agent.main.id
129+
agent_name = "main"
130+
order = 2
122131
}
123132

124133
resource "kubernetes_persistent_volume_claim" "home" {

0 commit comments

Comments
 (0)