Skip to content

Commit c50fa55

Browse files
committed
Add timeout field
1 parent 208a014 commit c50fa55

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
@@ -77,5 +77,6 @@ Required:
7777
Optional:
7878

7979
- `display_name` (String) The user-facing name of this value.
80+
- `timeout` (Number) The maximum time the command is allowed to run in seconds.
8081

8182

provider/agent.go

+6
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ func agentResource() *schema.Resource {
165165
Type: schema.TypeString,
166166
},
167167
},
168+
"timeout": {
169+
Type: schema.TypeInt,
170+
Description: "The maximum time the command is allowed to run in seconds.",
171+
ForceNew: true,
172+
Optional: true,
173+
},
168174
"interval": {
169175
Type: schema.TypeInt,
170176
Description: "The interval in seconds at which to refresh this metadata item. ",

provider/agent_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ func TestAgent_Metadata(t *testing.T) {
132132
display_name = "Process Count"
133133
cmd = ["sh", "-c", "ps aux | wc -l"]
134134
interval = 5
135+
timeout = 1
135136
}
136137
}
137138
`,
@@ -153,6 +154,7 @@ func TestAgent_Metadata(t *testing.T) {
153154
require.Equal(t, "-c", attr["metadata.0.cmd.1"])
154155
require.Equal(t, "ps aux | wc -l", attr["metadata.0.cmd.2"])
155156
require.Equal(t, "5", attr["metadata.0.interval"])
157+
require.Equal(t, "1", attr["metadata.0.timeout"])
156158
return nil
157159
},
158160
}},

0 commit comments

Comments
 (0)