Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 90194db

Browse files
authored
feat: Add shutdown_script_timeout (#96)
1 parent 66d82c9 commit 90194db

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

docs/data-sources/parameter.md

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Optional:
5656
- `error` (String) An error message to display if the value doesn't match the provided regex.
5757
- `max` (Number) The maximum of a number parameter.
5858
- `min` (Number) The minimum of a number parameter.
59+
- `monotonic` (String) Number monotonicity, either increasing or decreasing.
5960
- `regex` (String) A regex for the input parameter to match against.
6061

6162

docs/resources/agent.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ resource "kubernetes_pod" "dev" {
5353
- `login_before_ready` (Boolean) 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.
5454
- `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.
5555
- `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.
56+
- `shutdown_script_timeout` (Number) 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.
5657
- `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.
57-
- `startup_script_timeout` (Number) Time in seconds until the agent ready status is marked as timed out, this happens when the startup script has not completed (exited) in the given time.
58+
- `startup_script_timeout` (Number) Time in seconds until the agent lifecycle status is marked as timed out during start, this happens when the startup script has not completed (exited) in the given time.
5859
- `troubleshooting_url` (String) A URL to a document with instructions for troubleshooting problems with the agent.
5960

6061
### Read-Only

provider/agent.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func agentResource() *schema.Resource {
8686
Default: 300,
8787
ForceNew: true,
8888
Optional: true,
89-
Description: "Time in seconds until the agent ready status is marked as timed out, this happens when the startup script has not completed (exited) in the given time.",
89+
Description: "Time in seconds until the agent lifecycle status is marked as timed out during start, this happens when the startup script has not completed (exited) in the given time.",
9090
ValidateFunc: validation.IntAtLeast(1),
9191
},
9292
"shutdown_script": {
@@ -95,6 +95,14 @@ func agentResource() *schema.Resource {
9595
Optional: true,
9696
Description: "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.",
9797
},
98+
"shutdown_script_timeout": {
99+
Type: schema.TypeInt,
100+
Default: 300,
101+
ForceNew: true,
102+
Optional: true,
103+
Description: "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.",
104+
ValidateFunc: validation.IntAtLeast(1),
105+
},
98106
"token": {
99107
ForceNew: true,
100108
Sensitive: true,

provider/agent_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func TestAgent(t *testing.T) {
3535
troubleshooting_url = "https://example.com/troubleshoot"
3636
motd_file = "/etc/motd"
3737
shutdown_script = "echo bye bye"
38+
shutdown_script_timeout = 120
3839
login_before_ready = false
3940
}
4041
`,
@@ -56,6 +57,7 @@ func TestAgent(t *testing.T) {
5657
"troubleshooting_url",
5758
"motd_file",
5859
"shutdown_script",
60+
"shutdown_script_timeout",
5961
"login_before_ready",
6062
} {
6163
value := resource.Primary.Attributes[key]

0 commit comments

Comments
 (0)