-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add app share property #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
data "coder_parameter" "example" { | ||
display_name = "Region" | ||
description = "Specify a region to place your workspace." | ||
immutable = true | ||
type = "string" | ||
option { | ||
value = "us-central1-a" | ||
label = "US Central" | ||
icon = "/icon/usa.svg" | ||
} | ||
option { | ||
value = "asia-central1-a" | ||
label = "Asia" | ||
icon = "/icon/asia.svg" | ||
} | ||
display_name = "Region" | ||
description = "Specify a region to place your workspace." | ||
immutable = true | ||
type = "string" | ||
option { | ||
value = "us-central1-a" | ||
label = "US Central" | ||
icon = "/icon/usa.svg" | ||
} | ||
option { | ||
value = "asia-central1-a" | ||
label = "Asia" | ||
icon = "/icon/asia.svg" | ||
} | ||
} | ||
|
||
data "coder_parameter" "ami" { | ||
display_name = "Machine Image" | ||
option { | ||
value = "ami-xxxxxxxx" | ||
label = "Ubuntu" | ||
icon = "/icon/ubuntu.svg" | ||
} | ||
display_name = "Machine Image" | ||
option { | ||
value = "ami-xxxxxxxx" | ||
label = "Ubuntu" | ||
icon = "/icon/ubuntu.svg" | ||
} | ||
} | ||
|
||
data "coder_parameter" "image" { | ||
display_name = "Docker Image" | ||
icon = "/icon/docker.svg" | ||
type = "bool" | ||
display_name = "Docker Image" | ||
icon = "/icon/docker.svg" | ||
type = "bool" | ||
} | ||
|
||
data "coder_parameter" "cores" { | ||
display_name = "CPU Cores" | ||
icon = "/icon/" | ||
display_name = "CPU Cores" | ||
icon = "/icon/" | ||
} | ||
|
||
data "coder_parameter" "disk_size" { | ||
display_name = "Disk Size" | ||
type = "number" | ||
validation { | ||
# This can apply to number and string types. | ||
min = 0 | ||
max = 10 | ||
} | ||
display_name = "Disk Size" | ||
type = "number" | ||
validation { | ||
# This can apply to number and string types. | ||
min = 0 | ||
max = 10 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import ( | |
"net/url" | ||
|
||
"github.com/google/uuid" | ||
"github.com/hashicorp/go-cty/cty" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
@@ -76,6 +77,39 @@ func appResource() *schema.Resource { | |
ForceNew: true, | ||
Optional: true, | ||
}, | ||
"sharing_level": { | ||
Type: schema.TypeString, | ||
Description: "Determines the sharing level of the app. " + | ||
deansheather marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"Application sharing is an enterprise feature and any " + | ||
"values will be ignored (and sharing disabled) if your " + | ||
"deployment is not entitled to use application sharing. " + | ||
`Valid values are "owner", "template", "authenticated" ` + | ||
`and "public". Level "owner" disables sharing on the ` + | ||
"app, so only the workspace owner can access it. Level " + | ||
`"template" shares the app with all users that can read ` + | ||
`the workspace's template. Level "authenticated" shares ` + | ||
`the app with all authenticated users. Level "public" ` + | ||
"shares it with any user, including unauthenticated " + | ||
"users. Permitted application sharing levels can be " + | ||
`controlled via a flag on "coder server". Defaults to ` + | ||
`"owner" (sharing disabled).`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should wait to allow the blocking of sharing globally IMO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Talked to Kyle on slack and he agrees we should keep the flag but it should default to all levels being available if you're entitled to the feature. |
||
ForceNew: true, | ||
Optional: true, | ||
Default: "owner", | ||
ValidateDiagFunc: func(val interface{}, c cty.Path) diag.Diagnostics { | ||
valStr, ok := val.(string) | ||
if !ok { | ||
return diag.Errorf("expected string, got %T", val) | ||
} | ||
|
||
switch valStr { | ||
case "owner", "template", "authenticated", "public": | ||
return nil | ||
} | ||
|
||
return diag.Errorf(`invalid app sharing_level %q, must be one of "owner", "template", "authenticated", "public"`, valStr) | ||
}, | ||
}, | ||
"url": { | ||
Type: schema.TypeString, | ||
Description: "A URL to be proxied to from inside the workspace. " + | ||
|
Uh oh!
There was an error while loading. Please reload this page.