Skip to content

Commit 6724eaf

Browse files
authored
feat: Add "dir" option to "coder_agent" (#13)
This allows specifying where a shell will be opened when SSH'ing into a workspace.
1 parent bcf04aa commit 6724eaf

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

docs/resources/agent.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ data "coder_workspace" "me" {
1919
resource "coder_agent" "dev" {
2020
os = "linux"
2121
arch = "amd64"
22+
dir = "/workspace"
2223
}
2324
2425
resource "kubernetes_pod" "dev" {
@@ -46,6 +47,7 @@ resource "kubernetes_pod" "dev" {
4647
### Optional
4748

4849
- `auth` (String) The authentication type the agent will use. Must be one of: "token", "google-instance-identity", "aws-instance-identity", "azure-instance-identity".
50+
- `dir` (String) The starting directory when a user creates a shell session. Defaults to $HOME.
4951
- `env` (Map of String) A mapping of environment variables to set inside the workspace.
5052
- `id` (String) The ID of this resource.
5153
- `startup_script` (String) A script to run after the agent starts.

examples/resources/coder_agent/resource.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ data "coder_workspace" "me" {
44
resource "coder_agent" "dev" {
55
os = "linux"
66
arch = "amd64"
7+
dir = "/workspace"
78
}
89

910
resource "kubernetes_pod" "dev" {

internal/provider/provider.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ func New() *schema.Provider {
164164
Description: `The authentication type the agent will use. Must be one of: "token", "google-instance-identity", "aws-instance-identity", "azure-instance-identity".`,
165165
ValidateFunc: validation.StringInSlice([]string{"token", "google-instance-identity", "aws-instance-identity", "azure-instance-identity"}, false),
166166
},
167+
"dir": {
168+
Type: schema.TypeString,
169+
ForceNew: true,
170+
Optional: true,
171+
Description: "The starting directory when a user creates a shell session. Defaults to $HOME.",
172+
},
167173
"env": {
168174
ForceNew: true,
169175
Description: "A mapping of environment variables to set inside the workspace.",

internal/provider/provider_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func TestAgent(t *testing.T) {
6262
os = "linux"
6363
arch = "amd64"
6464
auth = "aws-instance-identity"
65+
dir = "/tmp"
6566
env = {
6667
hi = "test"
6768
}
@@ -78,6 +79,7 @@ func TestAgent(t *testing.T) {
7879
"os",
7980
"arch",
8081
"auth",
82+
"dir",
8183
"env.hi",
8284
"startup_script",
8385
} {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy