Skip to content

feat: deprecate relative_path in favor of subdomain #61

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

Merged
merged 2 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/resources/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ resource "coder_app" "code-server" {
name = "VS Code"
icon = data.coder_workspace.me.access_url + "/icons/vscode.svg"
url = "http://localhost:13337"
relative_path = true
subdomain = false
healthcheck {
url = "http://localhost:13337/healthz"
interval = 5
Expand All @@ -54,6 +54,7 @@ resource "coder_app" "intellij" {
```

<!-- schema generated by tfplugindocs -->

## Schema

### Required
Expand All @@ -66,20 +67,19 @@ resource "coder_app" "intellij" {
- `healthcheck` (Block Set, Max: 1) HTTP health checking to determine the application readiness. (see [below for nested schema](#nestedblock--healthcheck))
- `icon` (String) A URL to an icon that will display in the dashboard. View built-in icons here: https://github.com/coder/coder/tree/main/site/static/icons. Use a built-in icon with `data.coder_workspace.me.access_url + "/icons/<path>"`.
- `name` (String) A display name to identify the app.
- `relative_path` (Boolean) Specifies whether the URL will be accessed via a relative path or wildcard. Use if wildcard routing is unavailable.
- `subdomain` (Boolean) Determines whether the app will be accessed via it's own subdomain or whether it will be accessed via a path on Coder. If wildcards have not been setup by the administrator then apps with "subdomain" set to true will not be accessible. Defaults to false.
- `url` (String) A URL to be proxied to from inside the workspace. Either "command" or "url" may be specified, but not both.

### Read-Only

- `id` (String) The ID of this resource.

<a id="nestedblock--healthcheck"></a>

### Nested Schema for `healthcheck`

Required:

- `interval` (Number) Duration in seconds to wait between healthcheck requests.
- `threshold` (Number) Number of consecutive heathcheck failures before returning an unhealthy status.
- `url` (String) HTTP address used determine the application readiness. A successful health check is a HTTP response code less than 500 returned before healthcheck.interval seconds.


10 changes: 5 additions & 5 deletions examples/resources/coder_app/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ EOF
}

resource "coder_app" "code-server" {
agent_id = coder_agent.dev.id
name = "VS Code"
icon = data.coder_workspace.me.access_url + "/icons/vscode.svg"
url = "http://localhost:13337"
relative_path = true
agent_id = coder_agent.dev.id
name = "VS Code"
icon = data.coder_workspace.me.access_url + "/icons/vscode.svg"
url = "http://localhost:13337"
subdomain = false
healthcheck {
url = "http://localhost:13337/healthz"
interval = 5
Expand Down
19 changes: 14 additions & 5 deletions provider/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,21 @@ func appResource() *schema.Resource {
Optional: true,
},
"relative_path": {
Type: schema.TypeBool,
Type: schema.TypeBool,
Deprecated: "`relative_path` on apps is deprecated, use `subdomain` instead.",
Description: "Specifies whether the URL will be accessed via a relative " +
"path or wildcard. Use if wildcard routing is unavailable.",
ForceNew: true,
Optional: true,
ConflictsWith: []string{"command"},
"path or wildcard. Use if wildcard routing is unavailable. Defaults to true.",
ForceNew: true,
Optional: true,
},
"subdomain": {
Type: schema.TypeBool,
Description: "Determines whether the app will be accessed via it's own " +
"subdomain or whether it will be accessed via a path on Coder. If " +
"wildcards have not been setup by the administrator then apps with " +
"\"subdomain\" set to true will not be accessible. Defaults to false.",
ForceNew: true,
Optional: true,
},
"url": {
Type: schema.TypeString,
Expand Down
4 changes: 2 additions & 2 deletions provider/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestApp(t *testing.T) {
agent_id = coder_agent.dev.id
name = "code-server"
icon = "builtin:vim"
relative_path = true
subdomain = false
url = "http://localhost:13337"
healthcheck {
url = "http://localhost:13337/healthz"
Expand All @@ -47,7 +47,7 @@ func TestApp(t *testing.T) {
"agent_id",
"name",
"icon",
"relative_path",
"subdomain",
"url",
"healthcheck.0.url",
"healthcheck.0.interval",
Expand Down