Skip to content

fix: use updated limits for TCP check degraded/max response time [sc-23431] #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions checkly/resource_tcp_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,28 @@ func resourceTCPCheck() *schema.Resource {
"degraded_response_time": {
Type: schema.TypeInt,
Optional: true,
Default: 15000,
Default: 4000,
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
// https://checklyhq.com/docs/api-checks/limits/
v := val.(int)
if v < 0 || v > 30000 {
errs = append(errs, fmt.Errorf("%q must be 0-30000 ms, got %d", key, v))
if v < 0 || v > 5000 {
errs = append(errs, fmt.Errorf("%q must be 0-5000 ms, got %d", key, v))
}
return warns, errs
},
Description: "The response time in milliseconds starting from which a check should be considered degraded. Possible values are between 0 and 30000. (Default `15000`).",
Description: "The response time in milliseconds starting from which a check should be considered degraded. Possible values are between 0 and 5000. (Default `4000`).",
},
"max_response_time": {
Type: schema.TypeInt,
Optional: true,
Default: 30000,
Default: 5000,
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
v := val.(int)
// https://checklyhq.com/docs/api-checks/limits/
if v < 0 || v > 30000 {
errs = append(errs, fmt.Errorf("%q must be 0-30000 ms, got: %d", key, v))
if v < 0 || v > 5000 {
errs = append(errs, fmt.Errorf("%q must be 0-5000 ms, got: %d", key, v))
}
return warns, errs
},
Description: "The response time in milliseconds starting from which a check should be considered failing. Possible values are between 0 and 30000. (Default `30000`).",
Description: "The response time in milliseconds starting from which a check should be considered failing. Possible values are between 0 and 5000. (Default `5000`).",
},
"tags": {
Type: schema.TypeSet,
Expand Down
14 changes: 7 additions & 7 deletions checkly/resource_tcp_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ func TestAccTCPCheckFull(t *testing.T) {
resource.TestCheckResourceAttr(
"checkly_tcp_check.test",
"degraded_response_time",
"15000",
"4000",
),
resource.TestCheckResourceAttr(
"checkly_tcp_check.test",
"max_response_time",
"30000",
"5000",
),
testCheckResourceAttrExpr(
"checkly_tcp_check.test",
Expand Down Expand Up @@ -150,8 +150,8 @@ var wantTCPCheck = checkly.TCPCheck{
ShouldFail: false,
Locations: []string{"eu-west-1"},
PrivateLocations: &[]string{},
DegradedResponseTime: 15000,
MaxResponseTime: 30000,
DegradedResponseTime: 4000,
MaxResponseTime: 5000,
Tags: []string{
"foo",
"bar",
Expand Down Expand Up @@ -199,7 +199,7 @@ const tcpCheck_basic = `
frequency = 60
activated = true
muted = true
max_response_time = 18000
max_response_time = 3000
locations = [ "us-east-1", "eu-central-1" ]
use_global_alert_settings = true
request {
Expand All @@ -221,8 +221,8 @@ const tcpCheck_full = `
frequency = 120
activated = true
muted = true
degraded_response_time = 15000
max_response_time = 30000
degraded_response_time = 4000
max_response_time = 5000
locations = [
"eu-central-1",
"us-east-1",
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/tcp_check.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ resource "checkly_tcp_check" "example-tcp-check-2" {

- `alert_channel_subscription` (Block List) An array of channel IDs and whether they're activated or not. If you don't set at least one alert subscription for your check, we won't be able to alert you in case something goes wrong with it. (see [below for nested schema](#nestedblock--alert_channel_subscription))
- `alert_settings` (Block List, Max: 1) (see [below for nested schema](#nestedblock--alert_settings))
- `degraded_response_time` (Number) The response time in milliseconds starting from which a check should be considered degraded. Possible values are between 0 and 30000. (Default `15000`).
- `degraded_response_time` (Number) The response time in milliseconds starting from which a check should be considered degraded. Possible values are between 0 and 5000. (Default `4000`).
- `frequency_offset` (Number) To create a high frequency check, the property `frequency` must be `0` and `frequency_offset` can be `10`, `20` or `30`.
- `group_id` (Number) The id of the check group this check is part of.
- `group_order` (Number) The position of this check in a check group. It determines in what order checks are run when a group is triggered from the API or from CI/CD.
- `locations` (Set of String) An array of one or more data center locations where to run the this check. (Default ["us-east-1"])
- `max_response_time` (Number) The response time in milliseconds starting from which a check should be considered failing. Possible values are between 0 and 30000. (Default `30000`).
- `max_response_time` (Number) The response time in milliseconds starting from which a check should be considered failing. Possible values are between 0 and 5000. (Default `5000`).
- `muted` (Boolean) Determines if any notifications will be sent out when a check fails/degrades/recovers.
- `private_locations` (Set of String) An array of one or more private locations slugs.
- `retry_strategy` (Block Set, Max: 1) A strategy for retrying failed check runs. (see [below for nested schema](#nestedblock--retry_strategy))
Expand Down
Loading