From 258c32df63498f62f11a98e635d1532325d79be3 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Wed, 9 Nov 2022 12:18:10 +0000 Subject: [PATCH] fix: Improve connection_timeout docs and add validation --- docs/resources/agent.md | 2 +- provider/agent.go | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/resources/agent.md b/docs/resources/agent.md index 1cb9c605..4c9d1976 100644 --- a/docs/resources/agent.md +++ b/docs/resources/agent.md @@ -47,7 +47,7 @@ resource "kubernetes_pod" "dev" { ### Optional - `auth` (String) The authentication type the agent will use. Must be one of: "token", "google-instance-identity", "aws-instance-identity", "azure-instance-identity". -- `connection_timeout` (Number) Time in seconds until the agent is marked as timed out when a connection with the server cannot be established. +- `connection_timeout` (Number) Time in seconds until the agent is marked as timed out when a connection with the server cannot be established. A value of zero never marks the agent as timed out. - `dir` (String) The starting directory when a user creates a shell session. Defaults to $HOME. - `env` (Map of String) A mapping of environment variables to set inside the workspace. - `startup_script` (String) A script to run after the agent starts. diff --git a/provider/agent.go b/provider/agent.go index 5bf4588b..1301ca34 100644 --- a/provider/agent.go +++ b/provider/agent.go @@ -89,11 +89,12 @@ func agentResource() *schema.Resource { Computed: true, }, "connection_timeout": { - Type: schema.TypeInt, - Default: 120, - ForceNew: true, - Optional: true, - Description: "Time in seconds until the agent is marked as timed out when a connection with the server cannot be established.", + Type: schema.TypeInt, + Default: 120, + ForceNew: true, + Optional: true, + Description: "Time in seconds until the agent is marked as timed out when a connection with the server cannot be established. A value of zero never marks the agent as timed out.", + ValidateFunc: validation.IntAtLeast(0), }, "troubleshooting_url": { Type: schema.TypeString,