Skip to content

Commit 7815596

Browse files
authored
feat: Add order to coder_agent (#193)
1 parent 99ba884 commit 7815596

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

Diff for: docs/resources/agent.md

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ resource "kubernetes_pod" "dev" {
7979
- `login_before_ready` (Boolean, Deprecated) This option defines whether or not the user can (by default) login to the workspace before it is ready. Ready means that e.g. the startup_script is done and has exited. When enabled, users may see an incomplete workspace when logging in.
8080
- `metadata` (Block List) Each "metadata" block defines a single item consisting of a key/value pair. This feature is in alpha and may break in future releases. (see [below for nested schema](#nestedblock--metadata))
8181
- `motd_file` (String) The path to a file within the workspace containing a message to display to users when they login via SSH. A typical value would be /etc/motd.
82+
- `order` (Number) The order determines the position of agents in the UI presentation. The lowest order is shown first and agents with equal order are sorted by name (ascending order).
8283
- `shutdown_script` (String) A script to run before the agent is stopped. The script should exit when it is done to signal that the workspace can be stopped. This option is an alias for defining a "coder_script" resource with "run_on_stop" set to true.
8384
- `shutdown_script_timeout` (Number, Deprecated) Time in seconds until the agent lifecycle status is marked as timed out during shutdown, this happens when the shutdown script has not completed (exited) in the given time.
8485
- `startup_script` (String) A script to run after the agent starts. The script should exit when it is done to signal that the agent is ready. This option is an alias for defining a "coder_script" resource with "run_on_start" set to true.

Diff for: provider/agent.go

+6
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ func agentResource() *schema.Resource {
297297
},
298298
},
299299
},
300+
"order": {
301+
Type: schema.TypeInt,
302+
Description: "The order determines the position of agents in the UI presentation. The lowest order is shown first and agents with equal order are sorted by name (ascending order).",
303+
ForceNew: true,
304+
Optional: true,
305+
},
300306
},
301307
}
302308
}

Diff for: provider/agent_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func TestAgent(t *testing.T) {
3939
motd_file = "/etc/motd"
4040
shutdown_script = "echo bye bye"
4141
shutdown_script_timeout = 120
42+
order = 4
4243
}
4344
`,
4445
Check: func(state *terraform.State) error {
@@ -60,6 +61,7 @@ func TestAgent(t *testing.T) {
6061
"motd_file",
6162
"shutdown_script",
6263
"shutdown_script_timeout",
64+
"order",
6365
} {
6466
value := resource.Primary.Attributes[key]
6567
t.Logf("%q = %q", key, value)

0 commit comments

Comments
 (0)