Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit a3dc364

Browse files
feat: add order variable to coder_app modules (#177)
1 parent f335a62 commit a3dc364

File tree

9 files changed

+78
-9
lines changed

9 files changed

+78
-9
lines changed

.sample/main.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
coder = {
66
source = "coder/coder"
7-
version = ">= 0.12"
7+
version = ">= 0.17"
88
}
99
}
1010
}
@@ -50,6 +50,12 @@ variable "mutable" {
5050
description = "Whether the parameter is mutable."
5151
default = true
5252
}
53+
54+
variable "order" {
55+
type = number
56+
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)."
57+
default = null
58+
}
5359
# Add other variables here
5460

5561

@@ -72,6 +78,7 @@ resource "coder_app" "MODULE_NAME" {
7278
icon = local.icon_url
7379
subdomain = false
7480
share = "owner"
81+
order = var.order
7582

7683
# Remove if the app does not have a healthcheck endpoint
7784
healthcheck {

code-server/main.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
coder = {
66
source = "coder/coder"
7-
version = ">= 0.12"
7+
version = ">= 0.17"
88
}
99
}
1010
}
@@ -77,6 +77,12 @@ variable "share" {
7777
}
7878
}
7979

80+
variable "order" {
81+
type = number
82+
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)."
83+
default = null
84+
}
85+
8086
resource "coder_script" "code-server" {
8187
agent_id = var.agent_id
8288
display_name = "code-server"
@@ -101,6 +107,7 @@ resource "coder_app" "code-server" {
101107
icon = "/icon/code.svg"
102108
subdomain = false
103109
share = var.share
110+
order = var.order
104111

105112
healthcheck {
106113
url = "http://localhost:${var.port}/healthz"

filebrowser/main.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
coder = {
66
source = "coder/coder"
7-
version = ">= 0.12"
7+
version = ">= 0.17"
88
}
99
}
1010
}
@@ -52,6 +52,12 @@ variable "share" {
5252
}
5353
}
5454

55+
variable "order" {
56+
type = number
57+
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)."
58+
default = null
59+
}
60+
5561
resource "coder_script" "filebrowser" {
5662
agent_id = var.agent_id
5763
display_name = "File Browser"
@@ -74,4 +80,5 @@ resource "coder_app" "filebrowser" {
7480
icon = "https://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svg"
7581
subdomain = true
7682
share = var.share
83+
order = var.order
7784
}

jetbrains-gateway/main.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
coder = {
66
source = "coder/coder"
7-
version = ">= 0.11"
7+
version = ">= 0.17"
88
}
99
}
1010
}
@@ -34,6 +34,12 @@ variable "default" {
3434
description = "Default IDE"
3535
}
3636

37+
variable "order" {
38+
type = number
39+
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)."
40+
default = null
41+
}
42+
3743
variable "jetbrains_ide_versions" {
3844
type = map(object({
3945
build_number = string
@@ -184,6 +190,7 @@ resource "coder_app" "gateway" {
184190
display_name = try(lookup(local.jetbrains_ides, data.coder_parameter.jetbrains_ide.value).name, "JetBrains IDE")
185191
icon = try(lookup(local.jetbrains_ides, data.coder_parameter.jetbrains_ide.value).icon, "/icon/gateway.svg")
186192
external = true
193+
order = var.order
187194
url = join("", [
188195
"jetbrains-gateway://connect#type=coder&workspace=",
189196
data.coder_workspace.me.name,
@@ -230,4 +237,4 @@ output "version" {
230237

231238
output "url" {
232239
value = coder_app.gateway.url
233-
}
240+
}

jupyter-notebook/main.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
coder = {
66
source = "coder/coder"
7-
version = ">= 0.12"
7+
version = ">= 0.17"
88
}
99
}
1010
}
@@ -36,6 +36,12 @@ variable "share" {
3636
}
3737
}
3838

39+
variable "order" {
40+
type = number
41+
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)."
42+
default = null
43+
}
44+
3945
resource "coder_script" "jupyter-notebook" {
4046
agent_id = var.agent_id
4147
display_name = "jupyter-notebook"
@@ -55,4 +61,5 @@ resource "coder_app" "jupyter-notebook" {
5561
icon = "/icon/jupyter.svg"
5662
subdomain = true
5763
share = var.share
64+
order = var.order
5865
}

jupyterlab/main.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
coder = {
66
source = "coder/coder"
7-
version = ">= 0.12"
7+
version = ">= 0.17"
88
}
99
}
1010
}
@@ -36,6 +36,12 @@ variable "share" {
3636
}
3737
}
3838

39+
variable "order" {
40+
type = number
41+
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)."
42+
default = null
43+
}
44+
3945
resource "coder_script" "jupyterlab" {
4046
agent_id = var.agent_id
4147
display_name = "jupyterlab"
@@ -55,4 +61,5 @@ resource "coder_app" "jupyterlab" {
5561
icon = "/icon/jupyter.svg"
5662
subdomain = true
5763
share = var.share
64+
order = var.order
5865
}

vscode-desktop/main.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,18 @@ describe("vscode-desktop", async () => {
2020
expect(state.outputs.vscode_url.value).toBe(
2121
"vscode://coder.coder-remote/open?owner=default&workspace=default&token=$SESSION_TOKEN",
2222
);
23+
24+
const resources: any = state.resources;
25+
expect(resources[1].instances[0].attributes.order).toBeNull();
26+
});
27+
28+
it("expect order to be set", async () => {
29+
const state = await runTerraformApply(import.meta.dir, {
30+
agent_id: "foo",
31+
order: "22",
32+
});
33+
34+
const resources: any = state.resources;
35+
expect(resources[1].instances[0].attributes.order).toBe(22);
2336
});
2437
});

vscode-desktop/main.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
coder = {
66
source = "coder/coder"
7-
version = ">= 0.12"
7+
version = ">= 0.17"
88
}
99
}
1010
}
@@ -20,6 +20,12 @@ variable "folder" {
2020
default = ""
2121
}
2222

23+
variable "order" {
24+
type = number
25+
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)."
26+
default = null
27+
}
28+
2329
data "coder_workspace" "me" {}
2430

2531
resource "coder_app" "vscode" {
@@ -28,6 +34,7 @@ resource "coder_app" "vscode" {
2834
icon = "/icon/code.svg"
2935
slug = "vscode"
3036
display_name = "VS Code Desktop"
37+
order = var.order
3138
url = var.folder != "" ? join("", [
3239
"vscode://coder.coder-remote/open?owner=",
3340
data.coder_workspace.me.owner,

vscode-web/main.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
coder = {
66
source = "coder/coder"
7-
version = ">= 0.12"
7+
version = ">= 0.17"
88
}
99
}
1010
}
@@ -85,6 +85,12 @@ variable "telemetry_level" {
8585
}
8686
}
8787

88+
variable "order" {
89+
type = number
90+
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)."
91+
default = null
92+
}
93+
8894
resource "coder_script" "vscode-web" {
8995
agent_id = var.agent_id
9096
display_name = "VS Code Web"
@@ -107,6 +113,7 @@ resource "coder_app" "vscode-web" {
107113
icon = "/icon/code.svg"
108114
subdomain = true
109115
share = var.share
116+
order = var.order
110117

111118
healthcheck {
112119
url = "http://localhost:${var.port}/healthz"

0 commit comments

Comments
 (0)