File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,45 @@ The `coder_agent` resource can be configured as described in the
95
95
For example, you can use the ` env ` property to set environment variables that will be
96
96
inherited by all child processes of the agent, including SSH sessions.
97
97
98
+ #### startup_script
99
+
100
+ Use the Coder agent's ` startup_script ` to run additional commands like
101
+ installing IDEs and clone dotfile and project repos. In this example, the
102
+ project and dotfile repos are specified as Terraform input variables elsewhere
103
+ in the ` main.tf ` Note the ` & ` after the ` code-server ` start to execute
104
+ ` code-server ` process in the background so the ` startup_script ` can continue
105
+ with the repo cloning steps.
106
+
107
+ ``` hcl
108
+ resource "coder_agent" "coder" {
109
+ os = "linux"
110
+ arch = "amd64"
111
+ dir = "/home/coder"
112
+ startup_script = <<EOT
113
+ #!/bin/bash
114
+
115
+ # install code-server
116
+ curl -fsSL https://code-server.dev/install.sh | sh
117
+ code-server --auth none --port &
118
+
119
+ # clone repo
120
+ ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
121
+ git clone --progress git@github.com:${var.repo}
122
+
123
+ # use coder CLI to clone and install dotfiles
124
+ coder dotfiles -y ${var.dotfiles_uri}
125
+
126
+ EOT
127
+ }
128
+ ```
129
+
130
+ #### Logging
131
+
132
+ The output of the ` startup_script ` are located in
133
+ ` /tmp/coder-startup-script.log ` within the workspace.
134
+
135
+ The Coder agent log is located in ` /tmp/coder-agent.log ` within the workspace.
136
+
98
137
### Parameters
99
138
100
139
Templates often contain _ parameters_ . These are defined by ` variable ` blocks in
You can’t perform that action at this time.
0 commit comments