Skip to content

Commit 62fa731

Browse files
matifaliCopilot
andauthored
chore(dogfood): add IDE selection parameter (#19194)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 444874d commit 62fa731

File tree

1 file changed

+80
-8
lines changed

1 file changed

+80
-8
lines changed

dogfood/coder/main.tf

Lines changed: 80 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ locals {
175175
], ["us-pittsburgh"])[0]
176176
}
177177

178-
179178
data "coder_parameter" "region" {
180179
type = "string"
181180
name = "Region"
@@ -277,6 +276,74 @@ data "coder_workspace_tags" "tags" {
277276
}
278277
}
279278

279+
data "coder_parameter" "ide_choices" {
280+
type = "list(string)"
281+
name = "Select IDEs"
282+
form_type = "multi-select"
283+
mutable = true
284+
description = "Choose one or more IDEs to enable in your workspace"
285+
default = jsonencode(["vscode", "code-server", "cursor"])
286+
option {
287+
name = "VS Code Desktop"
288+
value = "vscode"
289+
icon = "/icon/code.svg"
290+
}
291+
option {
292+
name = "code-server"
293+
value = "code-server"
294+
icon = "/icon/code.svg"
295+
}
296+
option {
297+
name = "VS Code Web"
298+
value = "vscode-web"
299+
icon = "/icon/code.svg"
300+
}
301+
option {
302+
name = "JetBrains IDEs"
303+
value = "jetbrains"
304+
icon = "/icon/jetbrains.svg"
305+
}
306+
option {
307+
name = "JetBrains Fleet"
308+
value = "fleet"
309+
icon = "/icon/fleet.svg"
310+
}
311+
option {
312+
name = "Cursor"
313+
value = "cursor"
314+
icon = "/icon/cursor.svg"
315+
}
316+
option {
317+
name = "Windsurf"
318+
value = "windsurf"
319+
icon = "/icon/windsurf.svg"
320+
}
321+
option {
322+
name = "Zed"
323+
value = "zed"
324+
icon = "/icon/zed.svg"
325+
}
326+
}
327+
328+
data "coder_parameter" "vscode_channel" {
329+
count = contains(jsondecode(data.coder_parameter.ide_choices.value), "vscode") ? 1 : 0
330+
type = "string"
331+
name = "VS Code Desktop channel"
332+
description = "Choose the VS Code Desktop channel"
333+
mutable = true
334+
default = "stable"
335+
option {
336+
value = "stable"
337+
name = "Stable"
338+
icon = "/icon/code.svg"
339+
}
340+
option {
341+
value = "insiders"
342+
name = "Insiders"
343+
icon = "/icon/code-insiders.svg"
344+
}
345+
}
346+
280347
module "slackme" {
281348
count = data.coder_workspace.me.start_count
282349
source = "dev.registry.coder.com/coder/slackme/coder"
@@ -309,7 +376,7 @@ module "personalize" {
309376
}
310377

311378
module "code-server" {
312-
count = data.coder_workspace.me.start_count
379+
count = contains(jsondecode(data.coder_parameter.ide_choices.value), "code-server") ? data.coder_workspace.me.start_count : 0
313380
source = "dev.registry.coder.com/coder/code-server/coder"
314381
version = "1.3.1"
315382
agent_id = coder_agent.dev.id
@@ -319,7 +386,7 @@ module "code-server" {
319386
}
320387

321388
module "vscode-web" {
322-
count = data.coder_workspace.me.start_count
389+
count = contains(jsondecode(data.coder_parameter.ide_choices.value), "vscode-web") ? data.coder_workspace.me.start_count : 0
323390
source = "dev.registry.coder.com/coder/vscode-web/coder"
324391
version = "1.3.1"
325392
agent_id = coder_agent.dev.id
@@ -331,7 +398,7 @@ module "vscode-web" {
331398
}
332399

333400
module "jetbrains" {
334-
count = data.coder_workspace.me.start_count
401+
count = contains(jsondecode(data.coder_parameter.ide_choices.value), "jetbrains") ? data.coder_workspace.me.start_count : 0
335402
source = "dev.registry.coder.com/coder/jetbrains/coder"
336403
version = "1.0.3"
337404
agent_id = coder_agent.dev.id
@@ -356,23 +423,23 @@ module "coder-login" {
356423
}
357424

358425
module "cursor" {
359-
count = data.coder_workspace.me.start_count
426+
count = contains(jsondecode(data.coder_parameter.ide_choices.value), "cursor") ? data.coder_workspace.me.start_count : 0
360427
source = "dev.registry.coder.com/coder/cursor/coder"
361428
version = "1.3.0"
362429
agent_id = coder_agent.dev.id
363430
folder = local.repo_dir
364431
}
365432

366433
module "windsurf" {
367-
count = data.coder_workspace.me.start_count
434+
count = contains(jsondecode(data.coder_parameter.ide_choices.value), "windsurf") ? data.coder_workspace.me.start_count : 0
368435
source = "dev.registry.coder.com/coder/windsurf/coder"
369436
version = "1.1.1"
370437
agent_id = coder_agent.dev.id
371438
folder = local.repo_dir
372439
}
373440

374441
module "zed" {
375-
count = data.coder_workspace.me.start_count
442+
count = contains(jsondecode(data.coder_parameter.ide_choices.value), "zed") ? data.coder_workspace.me.start_count : 0
376443
source = "dev.registry.coder.com/coder/zed/coder"
377444
version = "1.1.0"
378445
agent_id = coder_agent.dev.id
@@ -381,7 +448,7 @@ module "zed" {
381448
}
382449

383450
module "jetbrains-fleet" {
384-
count = data.coder_workspace.me.start_count
451+
count = contains(jsondecode(data.coder_parameter.ide_choices.value), "fleet") ? data.coder_workspace.me.start_count : 0
385452
source = "registry.coder.com/coder/jetbrains-fleet/coder"
386453
version = "1.0.1"
387454
agent_id = coder_agent.dev.id
@@ -423,6 +490,11 @@ resource "coder_agent" "dev" {
423490
}
424491
startup_script_behavior = "blocking"
425492

493+
display_apps {
494+
vscode = contains(jsondecode(data.coder_parameter.ide_choices.value), "vscode") && try(data.coder_parameter.vscode_channel[0].value, "stable") == "stable"
495+
vscode_insiders = contains(jsondecode(data.coder_parameter.ide_choices.value), "vscode") && try(data.coder_parameter.vscode_channel[0].value, "stable") == "insiders"
496+
}
497+
426498
# The following metadata blocks are optional. They are used to display
427499
# information about your workspace in the dashboard. You can remove them
428500
# if you don't want to display any information.

0 commit comments

Comments
 (0)