From 11d7787cb04d31fcd377cd3f781296edcadf1a40 Mon Sep 17 00:00:00 2001 From: Eric Paulsen Date: Sun, 15 Oct 2023 21:58:03 -0400 Subject: [PATCH] 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"