Skip to content

Commit 8f5c549

Browse files
committed
feat: Add motd_file to coder_agent
This change allows us to enable better feature parity with OpenSSH by being able to display a message when users login. This is useful for template authors who want to inform their users about changes or reporting about the state of the workspace.
1 parent 08f66c8 commit 8f5c549

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

docs/resources/agent.md

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ resource "kubernetes_pod" "dev" {
5050
- `connection_timeout` (Number) Time in seconds until the agent is marked as timed out when a connection with the server cannot be established.
5151
- `dir` (String) The starting directory when a user creates a shell session. Defaults to $HOME.
5252
- `env` (Map of String) A mapping of environment variables to set inside the workspace.
53+
- `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.
5354
- `startup_script` (String) A script to run after the agent starts.
5455
- `troubleshooting_url` (String) A URL to a document with instructions for troubleshooting problems with the agent.
5556

provider/agent.go

+6
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ func agentResource() *schema.Resource {
101101
Optional: true,
102102
Description: "A URL to a document with instructions for troubleshooting problems with the agent.",
103103
},
104+
"motd_file": {
105+
Type: schema.TypeString,
106+
ForceNew: true,
107+
Optional: true,
108+
Description: "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.",
109+
},
104110
},
105111
}
106112
}

provider/agent_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func TestAgent(t *testing.T) {
3232
}
3333
startup_script = "echo test"
3434
troubleshooting_url = "https://example.com/troubleshoot"
35+
motd_file = "/etc/motd"
3536
}
3637
`,
3738
Check: func(state *terraform.State) error {
@@ -49,6 +50,7 @@ func TestAgent(t *testing.T) {
4950
"startup_script",
5051
"connection_timeout",
5152
"troubleshooting_url",
53+
"motd_file",
5254
} {
5355
value := resource.Primary.Attributes[key]
5456
t.Logf("%q = %q", key, value)

0 commit comments

Comments
 (0)