From 11d7787cb04d31fcd377cd3f781296edcadf1a40 Mon Sep 17 00:00:00 2001 From: Eric Paulsen Date: Sun, 15 Oct 2023 21:58:03 -0400 Subject: [PATCH 1/3] feat: share variable --- code-server/main.tf | 12 +++++++++++- filebrowser/main.tf | 12 +++++++++++- jupyter-notebook/main.tf | 12 +++++++++++- jupyterlab/main.tf | 12 +++++++++++- vscode-web/main.tf | 12 +++++++++++- 5 files changed, 55 insertions(+), 5 deletions(-) diff --git a/code-server/main.tf b/code-server/main.tf index 837f0db..1f6c995 100644 --- a/code-server/main.tf +++ b/code-server/main.tf @@ -62,6 +62,16 @@ variable "install_version" { default = "" } +variable "share" { + type = string + default = "owner" + validation { + + condition = var.share == "owner" || var.share == "authenticated" || var.share == "public" + error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'." + } +} + resource "coder_script" "code-server" { agent_id = var.agent_id display_name = "code-server" @@ -85,7 +95,7 @@ resource "coder_app" "code-server" { url = "http://localhost:${var.port}/${var.folder != "" ? "?folder=${urlencode(var.folder)}" : ""}" icon = "/icon/code.svg" subdomain = false - share = "owner" + share = var.share healthcheck { url = "http://localhost:${var.port}/healthz" diff --git a/filebrowser/main.tf b/filebrowser/main.tf index f479488..0f35ee7 100644 --- a/filebrowser/main.tf +++ b/filebrowser/main.tf @@ -43,6 +43,16 @@ variable "folder" { default = "~" } +variable "share" { + type = string + default = "owner" + validation { + + condition = var.share == "owner" || var.share == "authenticated" || var.share == "public" + error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'." + } +} + resource "coder_script" "filebrowser" { agent_id = var.agent_id display_name = "File Browser" @@ -64,5 +74,5 @@ resource "coder_app" "filebrowser" { url = "http://localhost:${var.port}" icon = "https://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svg" subdomain = true - share = "owner" + share = var.share } diff --git a/jupyter-notebook/main.tf b/jupyter-notebook/main.tf index fb36b86..96189ca 100644 --- a/jupyter-notebook/main.tf +++ b/jupyter-notebook/main.tf @@ -27,6 +27,16 @@ variable "port" { default = 19999 } +variable "share" { + type = string + default = "owner" + validation { + + condition = var.share == "owner" || var.share == "authenticated" || var.share == "public" + error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'." + } +} + resource "coder_script" "jupyter-notebook" { agent_id = var.agent_id display_name = "jupyter-notebook" @@ -45,5 +55,5 @@ resource "coder_app" "jupyter-notebook" { url = "http://localhost:${var.port}" icon = "/icon/jupyter.svg" subdomain = true - share = "owner" + share = var.share } diff --git a/jupyterlab/main.tf b/jupyterlab/main.tf index 1727aa4..de5f040 100644 --- a/jupyterlab/main.tf +++ b/jupyterlab/main.tf @@ -27,6 +27,16 @@ variable "port" { default = 19999 } +variable "share" { + type = string + default = "owner" + validation { + + condition = var.share == "owner" || var.share == "authenticated" || var.share == "public" + error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'." + } +} + resource "coder_script" "jupyterlab" { agent_id = var.agent_id display_name = "jupyterlab" @@ -45,5 +55,5 @@ resource "coder_app" "jupyterlab" { url = "http://localhost:${var.port}" icon = "/icon/jupyter.svg" subdomain = true - share = "owner" + share = var.share } diff --git a/vscode-web/main.tf b/vscode-web/main.tf index ef72c52..45757f4 100644 --- a/vscode-web/main.tf +++ b/vscode-web/main.tf @@ -26,6 +26,16 @@ variable "folder" { default = "" } +variable "share" { + type = string + default = "owner" + validation { + + condition = var.share == "owner" || var.share == "authenticated" || var.share == "public" + error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'." + } +} + variable "log_path" { type = string description = "The path to log." @@ -67,7 +77,7 @@ resource "coder_app" "vscode-web" { url = var.folder == "" ? "http://localhost:${var.port}" : "http://localhost:${var.port}?folder=${var.folder}" icon = "/icon/code.svg" subdomain = true - share = "owner" + share = var.share healthcheck { url = "http://localhost:${var.port}/healthz" From 52e4f3fb6f64c8c57957c68e7aeb563f433652a2 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Mon, 16 Oct 2023 17:54:24 +0300 Subject: [PATCH 2/3] bun fmt --- code-server/main.tf | 2 +- filebrowser/main.tf | 2 +- jupyter-notebook/main.tf | 2 +- jupyterlab/main.tf | 2 +- vscode-web/main.tf | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code-server/main.tf b/code-server/main.tf index 1f6c995..e93ef2f 100644 --- a/code-server/main.tf +++ b/code-server/main.tf @@ -63,7 +63,7 @@ variable "install_version" { } variable "share" { - type = string + type = string default = "owner" validation { diff --git a/filebrowser/main.tf b/filebrowser/main.tf index 0f35ee7..e942197 100644 --- a/filebrowser/main.tf +++ b/filebrowser/main.tf @@ -44,7 +44,7 @@ variable "folder" { } variable "share" { - type = string + type = string default = "owner" validation { diff --git a/jupyter-notebook/main.tf b/jupyter-notebook/main.tf index 96189ca..35b513f 100644 --- a/jupyter-notebook/main.tf +++ b/jupyter-notebook/main.tf @@ -28,7 +28,7 @@ variable "port" { } variable "share" { - type = string + type = string default = "owner" validation { diff --git a/jupyterlab/main.tf b/jupyterlab/main.tf index de5f040..51857c6 100644 --- a/jupyterlab/main.tf +++ b/jupyterlab/main.tf @@ -28,7 +28,7 @@ variable "port" { } variable "share" { - type = string + type = string default = "owner" validation { diff --git a/vscode-web/main.tf b/vscode-web/main.tf index 45757f4..f76e6d6 100644 --- a/vscode-web/main.tf +++ b/vscode-web/main.tf @@ -27,7 +27,7 @@ variable "folder" { } variable "share" { - type = string + type = string default = "owner" validation { From 4f78c20201bdaf88ca7e9e220aa21106b490003b Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Mon, 16 Oct 2023 17:59:18 +0300 Subject: [PATCH 3/3] fmt --- code-server/main.tf | 1 - filebrowser/main.tf | 1 - jupyter-notebook/main.tf | 1 - jupyterlab/main.tf | 1 - vscode-web/main.tf | 1 - 5 files changed, 5 deletions(-) diff --git a/code-server/main.tf b/code-server/main.tf index e93ef2f..86afdd0 100644 --- a/code-server/main.tf +++ b/code-server/main.tf @@ -66,7 +66,6 @@ variable "share" { type = string default = "owner" validation { - condition = var.share == "owner" || var.share == "authenticated" || var.share == "public" error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'." } diff --git a/filebrowser/main.tf b/filebrowser/main.tf index e942197..27790a2 100644 --- a/filebrowser/main.tf +++ b/filebrowser/main.tf @@ -47,7 +47,6 @@ variable "share" { type = string default = "owner" validation { - condition = var.share == "owner" || var.share == "authenticated" || var.share == "public" error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'." } diff --git a/jupyter-notebook/main.tf b/jupyter-notebook/main.tf index 35b513f..236dee8 100644 --- a/jupyter-notebook/main.tf +++ b/jupyter-notebook/main.tf @@ -31,7 +31,6 @@ variable "share" { type = string default = "owner" validation { - condition = var.share == "owner" || var.share == "authenticated" || var.share == "public" error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'." } diff --git a/jupyterlab/main.tf b/jupyterlab/main.tf index 51857c6..3e5e14b 100644 --- a/jupyterlab/main.tf +++ b/jupyterlab/main.tf @@ -31,7 +31,6 @@ variable "share" { type = string default = "owner" validation { - condition = var.share == "owner" || var.share == "authenticated" || var.share == "public" error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'." } diff --git a/vscode-web/main.tf b/vscode-web/main.tf index f76e6d6..1c5e9e7 100644 --- a/vscode-web/main.tf +++ b/vscode-web/main.tf @@ -30,7 +30,6 @@ variable "share" { type = string default = "owner" validation { - condition = var.share == "owner" || var.share == "authenticated" || var.share == "public" error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'." }