Skip to content

Commit

Permalink
feat: Add order to coder_agent (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtojek authored Feb 13, 2024
1 parent 99ba884 commit 7815596
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/resources/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ resource "kubernetes_pod" "dev" {
- `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.
- `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))
- `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.
- `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).
- `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.
- `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.
- `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.
Expand Down
6 changes: 6 additions & 0 deletions provider/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ func agentResource() *schema.Resource {
},
},
},
"order": {
Type: schema.TypeInt,
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).",
ForceNew: true,
Optional: true,
},
},
}
}
Expand Down
2 changes: 2 additions & 0 deletions provider/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func TestAgent(t *testing.T) {
motd_file = "/etc/motd"
shutdown_script = "echo bye bye"
shutdown_script_timeout = 120
order = 4
}
`,
Check: func(state *terraform.State) error {
Expand All @@ -60,6 +61,7 @@ func TestAgent(t *testing.T) {
"motd_file",
"shutdown_script",
"shutdown_script_timeout",
"order",
} {
value := resource.Primary.Attributes[key]
t.Logf("%q = %q", key, value)
Expand Down

0 comments on commit 7815596

Please sign in to comment.