diff --git a/docs/data-sources/parameter.md b/docs/data-sources/parameter.md index 20b61ddd..70750742 100644 --- a/docs/data-sources/parameter.md +++ b/docs/data-sources/parameter.md @@ -56,6 +56,7 @@ Optional: - `error` (String) An error message to display if the value doesn't match the provided regex. - `max` (Number) The maximum of a number parameter. - `min` (Number) The minimum of a number parameter. +- `monotonic` (String) Number monotonicity, either increasing or decreasing. - `regex` (String) A regex for the input parameter to match against. diff --git a/docs/resources/agent.md b/docs/resources/agent.md index 630650a3..1333d5bb 100644 --- a/docs/resources/agent.md +++ b/docs/resources/agent.md @@ -53,8 +53,9 @@ resource "kubernetes_pod" "dev" { - `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. - `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. - `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. +- `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. - `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. -- `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. +- `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. - `troubleshooting_url` (String) A URL to a document with instructions for troubleshooting problems with the agent. ### Read-Only diff --git a/provider/agent.go b/provider/agent.go index 23023a03..4d628927 100644 --- a/provider/agent.go +++ b/provider/agent.go @@ -86,7 +86,7 @@ func agentResource() *schema.Resource { Default: 300, ForceNew: true, Optional: true, - 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.", + 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.", ValidateFunc: validation.IntAtLeast(1), }, "shutdown_script": { @@ -95,6 +95,14 @@ func agentResource() *schema.Resource { Optional: true, 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.", }, + "shutdown_script_timeout": { + Type: schema.TypeInt, + Default: 300, + ForceNew: true, + Optional: true, + 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.", + ValidateFunc: validation.IntAtLeast(1), + }, "token": { ForceNew: true, Sensitive: true, diff --git a/provider/agent_test.go b/provider/agent_test.go index 68f46a10..445ed75b 100644 --- a/provider/agent_test.go +++ b/provider/agent_test.go @@ -35,6 +35,7 @@ func TestAgent(t *testing.T) { troubleshooting_url = "https://example.com/troubleshoot" motd_file = "/etc/motd" shutdown_script = "echo bye bye" + shutdown_script_timeout = 120 login_before_ready = false } `, @@ -56,6 +57,7 @@ func TestAgent(t *testing.T) { "troubleshooting_url", "motd_file", "shutdown_script", + "shutdown_script_timeout", "login_before_ready", } { value := resource.Primary.Attributes[key]