feat: add `order` variable to `coder_app` modules (#177)

pull/182/head
Michael Brewer 1 year ago committed by GitHub
parent f335a62891
commit a3dc364227
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -4,7 +4,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = ">= 0.12"
version = ">= 0.17"
}
}
}
@ -50,6 +50,12 @@ variable "mutable" {
description = "Whether the parameter is mutable."
default = true
}
variable "order" {
type = number
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)."
default = null
}
# Add other variables here
@ -72,6 +78,7 @@ resource "coder_app" "MODULE_NAME" {
icon = local.icon_url
subdomain = false
share = "owner"
order = var.order
# Remove if the app does not have a healthcheck endpoint
healthcheck {

@ -4,7 +4,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = ">= 0.12"
version = ">= 0.17"
}
}
}
@ -77,6 +77,12 @@ variable "share" {
}
}
variable "order" {
type = number
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)."
default = null
}
resource "coder_script" "code-server" {
agent_id = var.agent_id
display_name = "code-server"
@ -101,6 +107,7 @@ resource "coder_app" "code-server" {
icon = "/icon/code.svg"
subdomain = false
share = var.share
order = var.order
healthcheck {
url = "http://localhost:${var.port}/healthz"

@ -4,7 +4,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = ">= 0.12"
version = ">= 0.17"
}
}
}
@ -52,6 +52,12 @@ variable "share" {
}
}
variable "order" {
type = number
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)."
default = null
}
resource "coder_script" "filebrowser" {
agent_id = var.agent_id
display_name = "File Browser"
@ -74,4 +80,5 @@ resource "coder_app" "filebrowser" {
icon = "https://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svg"
subdomain = true
share = var.share
order = var.order
}

@ -4,7 +4,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = ">= 0.11"
version = ">= 0.17"
}
}
}
@ -34,6 +34,12 @@ variable "default" {
description = "Default IDE"
}
variable "order" {
type = number
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)."
default = null
}
variable "jetbrains_ide_versions" {
type = map(object({
build_number = string
@ -184,6 +190,7 @@ resource "coder_app" "gateway" {
display_name = try(lookup(local.jetbrains_ides, data.coder_parameter.jetbrains_ide.value).name, "JetBrains IDE")
icon = try(lookup(local.jetbrains_ides, data.coder_parameter.jetbrains_ide.value).icon, "/icon/gateway.svg")
external = true
order = var.order
url = join("", [
"jetbrains-gateway://connect#type=coder&workspace=",
data.coder_workspace.me.name,

@ -4,7 +4,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = ">= 0.12"
version = ">= 0.17"
}
}
}
@ -36,6 +36,12 @@ variable "share" {
}
}
variable "order" {
type = number
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)."
default = null
}
resource "coder_script" "jupyter-notebook" {
agent_id = var.agent_id
display_name = "jupyter-notebook"
@ -55,4 +61,5 @@ resource "coder_app" "jupyter-notebook" {
icon = "/icon/jupyter.svg"
subdomain = true
share = var.share
order = var.order
}

@ -4,7 +4,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = ">= 0.12"
version = ">= 0.17"
}
}
}
@ -36,6 +36,12 @@ variable "share" {
}
}
variable "order" {
type = number
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)."
default = null
}
resource "coder_script" "jupyterlab" {
agent_id = var.agent_id
display_name = "jupyterlab"
@ -55,4 +61,5 @@ resource "coder_app" "jupyterlab" {
icon = "/icon/jupyter.svg"
subdomain = true
share = var.share
order = var.order
}

@ -20,5 +20,18 @@ describe("vscode-desktop", async () => {
expect(state.outputs.vscode_url.value).toBe(
"vscode://coder.coder-remote/open?owner=default&workspace=default&token=$SESSION_TOKEN",
);
const resources: any = state.resources;
expect(resources[1].instances[0].attributes.order).toBeNull();
});
it("expect order to be set", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
order: "22",
});
const resources: any = state.resources;
expect(resources[1].instances[0].attributes.order).toBe(22);
});
});

@ -4,7 +4,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = ">= 0.12"
version = ">= 0.17"
}
}
}
@ -20,6 +20,12 @@ variable "folder" {
default = ""
}
variable "order" {
type = number
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)."
default = null
}
data "coder_workspace" "me" {}
resource "coder_app" "vscode" {
@ -28,6 +34,7 @@ resource "coder_app" "vscode" {
icon = "/icon/code.svg"
slug = "vscode"
display_name = "VS Code Desktop"
order = var.order
url = var.folder != "" ? join("", [
"vscode://coder.coder-remote/open?owner=",
data.coder_workspace.me.owner,

@ -4,7 +4,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = ">= 0.12"
version = ">= 0.17"
}
}
}
@ -85,6 +85,12 @@ variable "telemetry_level" {
}
}
variable "order" {
type = number
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)."
default = null
}
resource "coder_script" "vscode-web" {
agent_id = var.agent_id
display_name = "VS Code Web"
@ -107,6 +113,7 @@ resource "coder_app" "vscode-web" {
icon = "/icon/code.svg"
subdomain = true
share = var.share
order = var.order
healthcheck {
url = "http://localhost:${var.port}/healthz"

Loading…
Cancel
Save