From 7a00ae7d9c2fc1f67b7bd7eb338c1d6bf3705af6 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Fri, 9 Feb 2024 11:19:29 +0100 Subject: [PATCH] feat: Add `order` to `coder_app` (#190) --- docs/resources/agent.md | 4 +++- docs/resources/app.md | 1 + examples/resources/coder_agent/resource.tf | 2 ++ provider/agent.go | 2 +- provider/app.go | 6 ++++++ provider/app_test.go | 2 ++ 6 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/resources/agent.md b/docs/resources/agent.md index 8f96c852..9b07b2e7 100644 --- a/docs/resources/agent.md +++ b/docs/resources/agent.md @@ -43,6 +43,8 @@ resource "coder_agent" "dev" { timeout = 1 order = 1 } + + order = 1 } resource "kubernetes_pod" "dev" { @@ -114,5 +116,5 @@ Required: Optional: - `display_name` (String) The user-facing name of this value. -- `order` (Number) The order determines the position of agent metadata in the UI/CLI presentation. The lowest order is shown first and parameters with equal order are sorted by key (ascending order). +- `order` (Number) The order determines the position of agent metadata in the UI presentation. The lowest order is shown first and metadata with equal order are sorted by key (ascending order). - `timeout` (Number) The maximum time the command is allowed to run in seconds. diff --git a/docs/resources/app.md b/docs/resources/app.md index 53a8c127..631eb1ec 100644 --- a/docs/resources/app.md +++ b/docs/resources/app.md @@ -73,6 +73,7 @@ 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/icon. Use a built-in icon with `data.coder_workspace.me.access_url + "/icon/"`. - `name` (String, Deprecated) A display name to identify the app. +- `order` (Number) The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order). - `relative_path` (Boolean, Deprecated) Specifies whether the URL will be accessed via a relative path or wildcard. Use if wildcard routing is unavailable. Defaults to true. - `share` (String) Determines the "level" which the application is shared at. Valid levels are "owner" (default), "authenticated" and "public". Level "owner" disables sharing on the app, so only the workspace owner can access it. 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 configured site-wide via a flag on `coder server` (Enterprise only). - `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. diff --git a/examples/resources/coder_agent/resource.tf b/examples/resources/coder_agent/resource.tf index 0ed69ea3..6ccb07bf 100644 --- a/examples/resources/coder_agent/resource.tf +++ b/examples/resources/coder_agent/resource.tf @@ -28,6 +28,8 @@ resource "coder_agent" "dev" { timeout = 1 order = 1 } + + order = 1 } resource "kubernetes_pod" "dev" { diff --git a/provider/agent.go b/provider/agent.go index c2bbfee3..a24f4c1b 100644 --- a/provider/agent.go +++ b/provider/agent.go @@ -243,7 +243,7 @@ func agentResource() *schema.Resource { }, "order": { Type: schema.TypeInt, - Description: "The order determines the position of agent metadata in the UI/CLI presentation. The lowest order is shown first and parameters with equal order are sorted by key (ascending order).", + Description: "The order determines the position of agent metadata in the UI presentation. The lowest order is shown first and metadata with equal order are sorted by key (ascending order).", ForceNew: true, Optional: true, }, diff --git a/provider/app.go b/provider/app.go index d8471788..bd2eb21e 100644 --- a/provider/app.go +++ b/provider/app.go @@ -196,6 +196,12 @@ func appResource() *schema.Resource { }, }, }, + "order": { + Type: schema.TypeInt, + Description: "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order).", + ForceNew: true, + Optional: true, + }, }, } } diff --git a/provider/app_test.go b/provider/app_test.go index 3d4f44bb..f17513e1 100644 --- a/provider/app_test.go +++ b/provider/app_test.go @@ -44,6 +44,7 @@ func TestApp(t *testing.T) { interval = 5 threshold = 6 } + order = 4 } `, Check: func(state *terraform.State) error { @@ -64,6 +65,7 @@ func TestApp(t *testing.T) { "healthcheck.0.url", "healthcheck.0.interval", "healthcheck.0.threshold", + "order", } { value := resource.Primary.Attributes[key] t.Logf("%q = %q", key, value)