Skip to content

feat: add healthcheck parameters to coder_app #52

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 10 commits into from
Sep 22, 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
14 changes: 9 additions & 5 deletions docs/resources/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,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"
relative_path = true
}

resource "coder_app" "vim" {
Expand Down Expand Up @@ -58,6 +58,10 @@ resource "coder_app" "intellij" {
### Optional

- `command` (String) A command to run in a terminal opening this app. In the web, this will open in a new tab. In the CLI, this will SSH and execute the command. Either "command" or "url" may be specified, but not both.
- `healthcheck_enabled` (Boolean) Run a HTTP request periodically to determine the application readiness.
- `healthcheck_interval` (Number) Duration in seconds to wait between healthcheck requests.
- `healthcheck_threshold` (Number) Number of consecutive heathcheck failures before returning an unhealthy status.
- `healthcheck_url` (String) HTTP address used determine the application readiness.
- `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.
Expand Down
12 changes: 6 additions & 6 deletions docs/resources/metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ resource "kubernetes_pod" "dev" {
}

resource "tls_private_key" "example_key_pair" {
algorithm = "ECDSA"
algorithm = "ECDSA"
ecdsa_curve = "P256"
}

resource "coder_metadata" "pod_info" {
count = data.coder_workspace.me.start_count
count = data.coder_workspace.me.start_count
resource_id = kubernetes_pod.dev[0].id
item {
key = "description"
key = "description"
value = "This description will show up in the Coder dashboard."
}
item {
key = "pod_uid"
key = "pod_uid"
value = kubernetes_pod.dev[0].uid
}
item {
key = "public_key"
key = "public_key"
value = tls_private_key.example_key_pair.public_key_openssh
# The value of this item will be hidden from view by default
# The value of this item will be hidden from view by default
sensitive = true
}
}
Expand Down
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"
relative_path = true
}

resource "coder_app" "vim" {
Expand Down
12 changes: 6 additions & 6 deletions examples/resources/coder_metadata/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ resource "kubernetes_pod" "dev" {
}

resource "tls_private_key" "example_key_pair" {
algorithm = "ECDSA"
algorithm = "ECDSA"
ecdsa_curve = "P256"
}

resource "coder_metadata" "pod_info" {
count = data.coder_workspace.me.start_count
count = data.coder_workspace.me.start_count
resource_id = kubernetes_pod.dev[0].id
item {
key = "description"
key = "description"
value = "This description will show up in the Coder dashboard."
}
item {
key = "pod_uid"
key = "pod_uid"
value = kubernetes_pod.dev[0].uid
}
item {
key = "public_key"
key = "public_key"
value = tls_private_key.example_key_pair.public_key_openssh
# The value of this item will be hidden from view by default
# The value of this item will be hidden from view by default
sensitive = true
}
}
28 changes: 28 additions & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,34 @@ func New() *schema.Provider {
Optional: true,
ConflictsWith: []string{"command"},
},
"healthcheck_enabled": {
Type: schema.TypeBool,
Description: "Run a HTTP request periodically to determine the application readiness.",
ForceNew: true,
Optional: true,
ConflictsWith: []string{"command"},
},
"healthcheck_url": {
Type: schema.TypeString,
Description: "HTTP address used determine the application readiness.",
ForceNew: true,
Optional: true,
ConflictsWith: []string{"command"},
},
"healthcheck_interval": {
Type: schema.TypeInt,
Description: "Duration in seconds to wait between healthcheck requests.",
ForceNew: true,
Optional: true,
ConflictsWith: []string{"command"},
},
"healthcheck_threshold": {
Type: schema.TypeInt,
Description: "Number of consecutive heathcheck failures before returning an unhealthy status.",
ForceNew: true,
Optional: true,
ConflictsWith: []string{"command"},
},
},
},
"coder_metadata": {
Expand Down