Skip to content

Commit

Permalink
feat: Add connection_timeout and troubleshooting_url to agent (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
mafredri authored Nov 7, 2022
1 parent c474eba commit dbd74d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/resources/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ 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.
- `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.
- `troubleshooting_url` (String) A URL to a document with instructions for troubleshooting problems with the agent.

### Read-Only

Expand Down
13 changes: 13 additions & 0 deletions provider/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ func agentResource() *schema.Resource {
Type: schema.TypeString,
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.",
},
"troubleshooting_url": {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
Description: "A URL to a document with instructions for troubleshooting problems with the agent.",
},
},
}
}
Expand Down
3 changes: 3 additions & 0 deletions provider/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func TestAgent(t *testing.T) {
hi = "test"
}
startup_script = "echo test"
troubleshooting_url = "https://example.com/troubleshoot"
}
`,
Check: func(state *terraform.State) error {
Expand All @@ -46,6 +47,8 @@ func TestAgent(t *testing.T) {
"dir",
"env.hi",
"startup_script",
"connection_timeout",
"troubleshooting_url",
} {
value := resource.Primary.Attributes[key]
t.Logf("%q = %q", key, value)
Expand Down

0 comments on commit dbd74d6

Please sign in to comment.