Skip to content

Commit 11d7787

Browse files
Eric PaulsenEric Paulsen
Eric Paulsen
authored and
Eric Paulsen
committed
feat: share variable
1 parent b6ec1d8 commit 11d7787

File tree

5 files changed

+55
-5
lines changed

5 files changed

+55
-5
lines changed

code-server/main.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ variable "install_version" {
6262
default = ""
6363
}
6464

65+
variable "share" {
66+
type = string
67+
default = "owner"
68+
validation {
69+
70+
condition = var.share == "owner" || var.share == "authenticated" || var.share == "public"
71+
error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'."
72+
}
73+
}
74+
6575
resource "coder_script" "code-server" {
6676
agent_id = var.agent_id
6777
display_name = "code-server"
@@ -85,7 +95,7 @@ resource "coder_app" "code-server" {
8595
url = "http://localhost:${var.port}/${var.folder != "" ? "?folder=${urlencode(var.folder)}" : ""}"
8696
icon = "/icon/code.svg"
8797
subdomain = false
88-
share = "owner"
98+
share = var.share
8999

90100
healthcheck {
91101
url = "http://localhost:${var.port}/healthz"

filebrowser/main.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ variable "folder" {
4343
default = "~"
4444
}
4545

46+
variable "share" {
47+
type = string
48+
default = "owner"
49+
validation {
50+
51+
condition = var.share == "owner" || var.share == "authenticated" || var.share == "public"
52+
error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'."
53+
}
54+
}
55+
4656
resource "coder_script" "filebrowser" {
4757
agent_id = var.agent_id
4858
display_name = "File Browser"
@@ -64,5 +74,5 @@ resource "coder_app" "filebrowser" {
6474
url = "http://localhost:${var.port}"
6575
icon = "https://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svg"
6676
subdomain = true
67-
share = "owner"
77+
share = var.share
6878
}

jupyter-notebook/main.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ variable "port" {
2727
default = 19999
2828
}
2929

30+
variable "share" {
31+
type = string
32+
default = "owner"
33+
validation {
34+
35+
condition = var.share == "owner" || var.share == "authenticated" || var.share == "public"
36+
error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'."
37+
}
38+
}
39+
3040
resource "coder_script" "jupyter-notebook" {
3141
agent_id = var.agent_id
3242
display_name = "jupyter-notebook"
@@ -45,5 +55,5 @@ resource "coder_app" "jupyter-notebook" {
4555
url = "http://localhost:${var.port}"
4656
icon = "/icon/jupyter.svg"
4757
subdomain = true
48-
share = "owner"
58+
share = var.share
4959
}

jupyterlab/main.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ variable "port" {
2727
default = 19999
2828
}
2929

30+
variable "share" {
31+
type = string
32+
default = "owner"
33+
validation {
34+
35+
condition = var.share == "owner" || var.share == "authenticated" || var.share == "public"
36+
error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'."
37+
}
38+
}
39+
3040
resource "coder_script" "jupyterlab" {
3141
agent_id = var.agent_id
3242
display_name = "jupyterlab"
@@ -45,5 +55,5 @@ resource "coder_app" "jupyterlab" {
4555
url = "http://localhost:${var.port}"
4656
icon = "/icon/jupyter.svg"
4757
subdomain = true
48-
share = "owner"
58+
share = var.share
4959
}

vscode-web/main.tf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ variable "folder" {
2626
default = ""
2727
}
2828

29+
variable "share" {
30+
type = string
31+
default = "owner"
32+
validation {
33+
34+
condition = var.share == "owner" || var.share == "authenticated" || var.share == "public"
35+
error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'."
36+
}
37+
}
38+
2939
variable "log_path" {
3040
type = string
3141
description = "The path to log."
@@ -67,7 +77,7 @@ resource "coder_app" "vscode-web" {
6777
url = var.folder == "" ? "http://localhost:${var.port}" : "http://localhost:${var.port}?folder=${var.folder}"
6878
icon = "/icon/code.svg"
6979
subdomain = true
70-
share = "owner"
80+
share = var.share
7181

7282
healthcheck {
7383
url = "http://localhost:${var.port}/healthz"

0 commit comments

Comments
 (0)