diff --git a/checkly/resource_check.go b/checkly/resource_check.go index 34805f3..d6db867 100644 --- a/checkly/resource_check.go +++ b/checkly/resource_check.go @@ -287,6 +287,26 @@ func resourceCheck() *schema.Resource { }, }, }, + "parallel_run_failure_threshold": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Applicable only for checks scheduled in parallel in multiple locations.", + }, + "percentage": { + Type: schema.TypeInt, + Optional: true, + Default: 10, + Description: "Possible values are `10`, `20`, `30`, `40`, `50`, `60`, `70`, `80`, `100`, and `100`. (Default `10`).", + }, + }, + }, + }, "ssl_certificates": { Type: schema.TypeSet, Optional: true, @@ -663,6 +683,12 @@ func setFromAlertSettings(as checkly.AlertSettings) []tfMap { "interval": as.Reminders.Interval, }, }, + "parallel_run_failure_threshold": []tfMap{ + { + "enabled": as.ParallelRunFailureThreshold.Enabled, + "percentage": as.ParallelRunFailureThreshold.Percentage, + }, + }, }, } } else { @@ -680,6 +706,12 @@ func setFromAlertSettings(as checkly.AlertSettings) []tfMap { "interval": as.Reminders.Interval, }, }, + "parallel_run_failure_threshold": []tfMap{ + { + "enabled": as.ParallelRunFailureThreshold.Enabled, + "percentage": as.ParallelRunFailureThreshold.Percentage, + }, + }, }, } } @@ -859,8 +891,9 @@ func alertSettingsFromSet(s *schema.Set) checkly.AlertSettings { } res := s.List()[0].(tfMap) alertSettings := checkly.AlertSettings{ - EscalationType: res["escalation_type"].(string), - Reminders: remindersFromSet(res["reminders"].(*schema.Set)), + EscalationType: res["escalation_type"].(string), + Reminders: remindersFromSet(res["reminders"].(*schema.Set)), + ParallelRunFailureThreshold: parallelRunFailureThresholdFromSet(res["parallel_run_failure_threshold"].(*schema.Set)), } if alertSettings.EscalationType == checkly.RunBased { @@ -954,6 +987,17 @@ func remindersFromSet(s *schema.Set) checkly.Reminders { } } +func parallelRunFailureThresholdFromSet(s *schema.Set) checkly.ParallelRunFailureThreshold { + if s.Len() == 0 { + return checkly.ParallelRunFailureThreshold{} + } + res := s.List()[0].(tfMap) + return checkly.ParallelRunFailureThreshold{ + Enabled: res["enabled"].(bool), + Percentage: res["percentage"].(int), + } +} + func requestFromSet(s *schema.Set) checkly.Request { if s.Len() == 0 { return checkly.Request{} diff --git a/checkly/resource_check_group.go b/checkly/resource_check_group.go index 6a5fd89..78a8e82 100644 --- a/checkly/resource_check_group.go +++ b/checkly/resource_check_group.go @@ -209,6 +209,26 @@ func resourceCheckGroup() *schema.Resource { }, }, }, + "parallel_run_failure_threshold": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Applicable only for checks scheduled in parallel in multiple locations.", + }, + "percentage": { + Type: schema.TypeInt, + Optional: true, + Default: 10, + Description: "Possible values are `10`, `20`, `30`, `40`, `50`, `60`, `70`, `80`, `100`, and `100`. (Default `10`).", + }, + }, + }, + }, "ssl_certificates": { Type: schema.TypeSet, Optional: true, diff --git a/checkly/resource_check_group_test.go b/checkly/resource_check_group_test.go index 217e20e..eabc14a 100644 --- a/checkly/resource_check_group_test.go +++ b/checkly/resource_check_group_test.go @@ -416,6 +416,10 @@ const testCheckGroup_full = ` amount = 2 interval = 5 } + parallel_run_failure_threshold { + enabled = false + percentage = 10 + } } local_setup_script = "setup-test" local_teardown_script = "teardown-test" diff --git a/checkly/resource_check_test.go b/checkly/resource_check_test.go index fab50de..693c49d 100644 --- a/checkly/resource_check_test.go +++ b/checkly/resource_check_test.go @@ -601,6 +601,10 @@ const apiCheck_full = ` run_based_escalation { failed_run_threshold = 1 } + parallel_run_failure_threshold { + enabled = false + percentage = 10 + } } } ` diff --git a/checkly/resource_heartbeat.go b/checkly/resource_heartbeat.go index d4e4347..002f1d1 100644 --- a/checkly/resource_heartbeat.go +++ b/checkly/resource_heartbeat.go @@ -105,6 +105,26 @@ func resourceHeartbeat() *schema.Resource { }, }, }, + "parallel_run_failure_threshold": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Applicable only for checks scheduled in parallel in multiple locations.", + }, + "percentage": { + Type: schema.TypeInt, + Optional: true, + Default: 10, + Description: "Possible values are `10`, `20`, `30`, `40`, `50`, `60`, `70`, `80`, `100`, and `100`. (Default `10`).", + }, + }, + }, + }, "ssl_certificates": { Type: schema.TypeSet, Optional: true, diff --git a/docs/resources/check.md b/docs/resources/check.md index f7c3b3c..0dd2889 100644 --- a/docs/resources/check.md +++ b/docs/resources/check.md @@ -243,11 +243,21 @@ Required: Optional: - `escalation_type` (String) Determines what type of escalation to use. Possible values are `RUN_BASED` or `TIME_BASED`. +- `parallel_run_failure_threshold` (Block Set) (see [below for nested schema](#nestedblock--alert_settings--parallel_run_failure_threshold)) - `reminders` (Block Set) (see [below for nested schema](#nestedblock--alert_settings--reminders)) - `run_based_escalation` (Block Set) (see [below for nested schema](#nestedblock--alert_settings--run_based_escalation)) - `ssl_certificates` (Block Set, Deprecated) (see [below for nested schema](#nestedblock--alert_settings--ssl_certificates)) - `time_based_escalation` (Block Set) (see [below for nested schema](#nestedblock--alert_settings--time_based_escalation)) + +### Nested Schema for `alert_settings.parallel_run_failure_threshold` + +Optional: + +- `enabled` (Boolean) Applicable only for checks scheduled in parallel in multiple locations. +- `percentage` (Number) Possible values are `10`, `20`, `30`, `40`, `50`, `60`, `70`, `80`, `100`, and `100`. (Default `10`). + + ### Nested Schema for `alert_settings.reminders` diff --git a/docs/resources/check_group.md b/docs/resources/check_group.md index c01ac46..01ccb02 100644 --- a/docs/resources/check_group.md +++ b/docs/resources/check_group.md @@ -183,11 +183,21 @@ Required: Optional: - `escalation_type` (String) Determines what type of escalation to use. Possible values are `RUN_BASED` or `TIME_BASED`. +- `parallel_run_failure_threshold` (Block Set) (see [below for nested schema](#nestedblock--alert_settings--parallel_run_failure_threshold)) - `reminders` (Block Set) (see [below for nested schema](#nestedblock--alert_settings--reminders)) - `run_based_escalation` (Block Set) (see [below for nested schema](#nestedblock--alert_settings--run_based_escalation)) - `ssl_certificates` (Block Set, Deprecated) (see [below for nested schema](#nestedblock--alert_settings--ssl_certificates)) - `time_based_escalation` (Block Set) (see [below for nested schema](#nestedblock--alert_settings--time_based_escalation)) + +### Nested Schema for `alert_settings.parallel_run_failure_threshold` + +Optional: + +- `enabled` (Boolean) Applicable only for checks scheduled in parallel in multiple locations. +- `percentage` (Number) Possible values are `10`, `20`, `30`, `40`, `50`, `60`, `70`, `80`, `100`, and `100`. (Default `10`). + + ### Nested Schema for `alert_settings.reminders` diff --git a/docs/resources/heartbeat.md b/docs/resources/heartbeat.md index de60921..3a0d932 100644 --- a/docs/resources/heartbeat.md +++ b/docs/resources/heartbeat.md @@ -63,11 +63,21 @@ Required: Optional: - `escalation_type` (String) Determines what type of escalation to use. Possible values are `RUN_BASED` or `TIME_BASED`. +- `parallel_run_failure_threshold` (Block Set) (see [below for nested schema](#nestedblock--alert_settings--parallel_run_failure_threshold)) - `reminders` (Block Set) (see [below for nested schema](#nestedblock--alert_settings--reminders)) - `run_based_escalation` (Block Set) (see [below for nested schema](#nestedblock--alert_settings--run_based_escalation)) - `ssl_certificates` (Block Set, Deprecated) (see [below for nested schema](#nestedblock--alert_settings--ssl_certificates)) - `time_based_escalation` (Block Set) (see [below for nested schema](#nestedblock--alert_settings--time_based_escalation)) + +### Nested Schema for `alert_settings.parallel_run_failure_threshold` + +Optional: + +- `enabled` (Boolean) Applicable only for checks scheduled in parallel in multiple locations. +- `percentage` (Number) Possible values are `10`, `20`, `30`, `40`, `50`, `60`, `70`, `80`, `100`, and `100`. (Default `10`). + + ### Nested Schema for `alert_settings.reminders` diff --git a/go.mod b/go.mod index e723d08..00ce8b9 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/aws/aws-sdk-go v1.44.122 // indirect - github.com/checkly/checkly-go-sdk v1.7.1 + github.com/checkly/checkly-go-sdk v1.7.2 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/go-cmp v0.5.9 github.com/gruntwork-io/terratest v0.41.16 diff --git a/go.sum b/go.sum index 03103cb..8d34497 100644 --- a/go.sum +++ b/go.sum @@ -231,8 +231,8 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/checkly/checkly-go-sdk v1.7.1 h1:6pIu821nf2OjzdaZ8hfNGKcIMaVLzaU7JWDJlk66XGM= -github.com/checkly/checkly-go-sdk v1.7.1/go.mod h1:Pd6tBOggAe41NnCU5KwqA8JvD6J20/IctszT2E0AvHo= +github.com/checkly/checkly-go-sdk v1.7.2 h1:+hDIURg7M+0HP4PhkZtQ3DdNQW6VwUeoSudC9iKLLgU= +github.com/checkly/checkly-go-sdk v1.7.2/go.mod h1:Pd6tBOggAe41NnCU5KwqA8JvD6J20/IctszT2E0AvHo= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=