Skip to content

Commit

Permalink
Add timeout field
Browse files Browse the repository at this point in the history
  • Loading branch information
ammario committed Mar 15, 2023
1 parent 208a014 commit c50fa55
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/resources/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@ Required:
Optional:

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


6 changes: 6 additions & 0 deletions provider/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ func agentResource() *schema.Resource {
Type: schema.TypeString,
},
},
"timeout": {
Type: schema.TypeInt,
Description: "The maximum time the command is allowed to run in seconds.",
ForceNew: true,
Optional: true,
},
"interval": {
Type: schema.TypeInt,
Description: "The interval in seconds at which to refresh this metadata item. ",
Expand Down
2 changes: 2 additions & 0 deletions provider/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func TestAgent_Metadata(t *testing.T) {
display_name = "Process Count"
cmd = ["sh", "-c", "ps aux | wc -l"]
interval = 5
timeout = 1
}
}
`,
Expand All @@ -153,6 +154,7 @@ func TestAgent_Metadata(t *testing.T) {
require.Equal(t, "-c", attr["metadata.0.cmd.1"])
require.Equal(t, "ps aux | wc -l", attr["metadata.0.cmd.2"])
require.Equal(t, "5", attr["metadata.0.interval"])
require.Equal(t, "1", attr["metadata.0.timeout"])
return nil
},
}},
Expand Down

0 comments on commit c50fa55

Please sign in to comment.