Skip to content

Commit 08162f5

Browse files
authored
Merge pull request coder#91 from coder/share-var
feat: share variable
2 parents e090e79 + 4f78c20 commit 08162f5

File tree

5 files changed

+50
-5
lines changed

5 files changed

+50
-5
lines changed

code-server/main.tf

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

65+
variable "share" {
66+
type = string
67+
default = "owner"
68+
validation {
69+
condition = var.share == "owner" || var.share == "authenticated" || var.share == "public"
70+
error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'."
71+
}
72+
}
73+
6574
resource "coder_script" "code-server" {
6675
agent_id = var.agent_id
6776
display_name = "code-server"
@@ -85,7 +94,7 @@ resource "coder_app" "code-server" {
8594
url = "http://localhost:${var.port}/${var.folder != "" ? "?folder=${urlencode(var.folder)}" : ""}"
8695
icon = "/icon/code.svg"
8796
subdomain = false
88-
share = "owner"
97+
share = var.share
8998

9099
healthcheck {
91100
url = "http://localhost:${var.port}/healthz"

filebrowser/main.tf

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

46+
variable "share" {
47+
type = string
48+
default = "owner"
49+
validation {
50+
condition = var.share == "owner" || var.share == "authenticated" || var.share == "public"
51+
error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'."
52+
}
53+
}
54+
4655
resource "coder_script" "filebrowser" {
4756
agent_id = var.agent_id
4857
display_name = "File Browser"
@@ -64,5 +73,5 @@ resource "coder_app" "filebrowser" {
6473
url = "http://localhost:${var.port}"
6574
icon = "https://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svg"
6675
subdomain = true
67-
share = "owner"
76+
share = var.share
6877
}

jupyter-notebook/main.tf

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

30+
variable "share" {
31+
type = string
32+
default = "owner"
33+
validation {
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+
3039
resource "coder_script" "jupyter-notebook" {
3140
agent_id = var.agent_id
3241
display_name = "jupyter-notebook"
@@ -45,5 +54,5 @@ resource "coder_app" "jupyter-notebook" {
4554
url = "http://localhost:${var.port}"
4655
icon = "/icon/jupyter.svg"
4756
subdomain = true
48-
share = "owner"
57+
share = var.share
4958
}

jupyterlab/main.tf

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

30+
variable "share" {
31+
type = string
32+
default = "owner"
33+
validation {
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+
3039
resource "coder_script" "jupyterlab" {
3140
agent_id = var.agent_id
3241
display_name = "jupyterlab"
@@ -45,5 +54,5 @@ resource "coder_app" "jupyterlab" {
4554
url = "http://localhost:${var.port}"
4655
icon = "/icon/jupyter.svg"
4756
subdomain = true
48-
share = "owner"
57+
share = var.share
4958
}

vscode-web/main.tf

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

29+
variable "share" {
30+
type = string
31+
default = "owner"
32+
validation {
33+
condition = var.share == "owner" || var.share == "authenticated" || var.share == "public"
34+
error_message = "Incorrect value. Please set either 'owner', 'authenticated', or 'public'."
35+
}
36+
}
37+
2938
variable "log_path" {
3039
type = string
3140
description = "The path to log."
@@ -67,7 +76,7 @@ resource "coder_app" "vscode-web" {
6776
url = var.folder == "" ? "http://localhost:${var.port}" : "http://localhost:${var.port}?folder=${var.folder}"
6877
icon = "/icon/code.svg"
6978
subdomain = true
70-
share = "owner"
79+
share = var.share
7180

7281
healthcheck {
7382
url = "http://localhost:${var.port}/healthz"

0 commit comments

Comments
 (0)