Skip to content

Commit e9305f5

Browse files
authored
feat: Add support for shutdown_script (#79)
1 parent e68c441 commit e9305f5

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
@@ -51,6 +51,7 @@ resource "kubernetes_pod" "dev" {
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.
5353
- `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.
54+
- `shutdown_script` (String) A script to run before the agent is stopped.
5455
- `startup_script` (String) A script to run after the agent starts.
5556
- `troubleshooting_url` (String) A URL to a document with instructions for troubleshooting problems with the agent.
5657

provider/agent.go

+6
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ func agentResource() *schema.Resource {
107107
Optional: true,
108108
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.",
109109
},
110+
"shutdown_script": {
111+
ForceNew: true,
112+
Description: "A script to run before the agent is stopped.",
113+
Type: schema.TypeString,
114+
Optional: true,
115+
},
110116
},
111117
}
112118
}

provider/agent_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func TestAgent(t *testing.T) {
3333
startup_script = "echo test"
3434
troubleshooting_url = "https://example.com/troubleshoot"
3535
motd_file = "/etc/motd"
36+
shutdown_script = "echo bye bye"
3637
}
3738
`,
3839
Check: func(state *terraform.State) error {
@@ -51,6 +52,7 @@ func TestAgent(t *testing.T) {
5152
"connection_timeout",
5253
"troubleshooting_url",
5354
"motd_file",
55+
"shutdown_script",
5456
} {
5557
value := resource.Primary.Attributes[key]
5658
t.Logf("%q = %q", key, value)

0 commit comments

Comments
 (0)