aboutsummaryrefslogtreecommitdiffhomepage
path: root/statuscake/resource_statuscaketest.go
diff options
context:
space:
mode:
Diffstat (limited to 'statuscake/resource_statuscaketest.go')
-rw-r--r--statuscake/resource_statuscaketest.go23
1 files changed, 14 insertions, 9 deletions
diff --git a/statuscake/resource_statuscaketest.go b/statuscake/resource_statuscaketest.go
index d7d3f36..b0dc84f 100644
--- a/statuscake/resource_statuscaketest.go
+++ b/statuscake/resource_statuscaketest.go
@@ -51,9 +51,11 @@ func resourceStatusCakeTest() *schema.Resource {
51 Required: true, 51 Required: true,
52 }, 52 },
53 53
54 "contact_id": { 54 "contact_group": {
55 Type: schema.TypeInt, 55 Type: schema.TypeSet,
56 Elem: &schema.Schema{Type: schema.TypeString},
56 Optional: true, 57 Optional: true,
58 Set: schema.HashString,
57 }, 59 },
58 60
59 "check_rate": { 61 "check_rate": {
@@ -94,6 +96,7 @@ func resourceStatusCakeTest() *schema.Resource {
94 Optional: true, 96 Optional: true,
95 Default: 5, 97 Default: 5,
96 }, 98 },
99
97 "custom_header": { 100 "custom_header": {
98 Type: schema.TypeString, 101 Type: schema.TypeString,
99 Optional: true, 102 Optional: true,
@@ -178,8 +181,10 @@ func resourceStatusCakeTest() *schema.Resource {
178 }, 181 },
179 182
180 "test_tags": { 183 "test_tags": {
181 Type: schema.TypeString, 184 Type: schema.TypeSet,
185 Elem: &schema.Schema{Type: schema.TypeString},
182 Optional: true, 186 Optional: true,
187 Set: schema.HashString,
183 }, 188 },
184 189
185 "status_codes": { 190 "status_codes": {
@@ -220,7 +225,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error {
220 TestType: d.Get("test_type").(string), 225 TestType: d.Get("test_type").(string),
221 Paused: d.Get("paused").(bool), 226 Paused: d.Get("paused").(bool),
222 Timeout: d.Get("timeout").(int), 227 Timeout: d.Get("timeout").(int),
223 ContactID: d.Get("contact_id").(int), 228 ContactGroup: castSetToSliceStrings(d.Get("contact_group").(*schema.Set).List()),
224 Confirmation: d.Get("confirmations").(int), 229 Confirmation: d.Get("confirmations").(int),
225 Port: d.Get("port").(int), 230 Port: d.Get("port").(int),
226 TriggerRate: d.Get("trigger_rate").(int), 231 TriggerRate: d.Get("trigger_rate").(int),
@@ -240,7 +245,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error {
240 FindString: d.Get("find_string").(string), 245 FindString: d.Get("find_string").(string),
241 DoNotFind: d.Get("do_not_find").(bool), 246 DoNotFind: d.Get("do_not_find").(bool),
242 RealBrowser: d.Get("real_browser").(int), 247 RealBrowser: d.Get("real_browser").(int),
243 TestTags: d.Get("test_tags").(string), 248 TestTags: castSetToSliceStrings(d.Get("test_tags").(*schema.Set).List()),
244 StatusCodes: d.Get("status_codes").(string), 249 StatusCodes: d.Get("status_codes").(string),
245 UseJar: d.Get("use_jar").(int), 250 UseJar: d.Get("use_jar").(int),
246 PostRaw: d.Get("post_raw").(string), 251 PostRaw: d.Get("post_raw").(string),
@@ -309,7 +314,7 @@ func ReadTest(d *schema.ResourceData, meta interface{}) error {
309 d.Set("test_type", testResp.TestType) 314 d.Set("test_type", testResp.TestType)
310 d.Set("paused", testResp.Paused) 315 d.Set("paused", testResp.Paused)
311 d.Set("timeout", testResp.Timeout) 316 d.Set("timeout", testResp.Timeout)
312 d.Set("contact_id", testResp.ContactID) 317 d.Set("contact_group", testResp.ContactGroup)
313 d.Set("confirmations", testResp.Confirmation) 318 d.Set("confirmations", testResp.Confirmation)
314 d.Set("port", testResp.Port) 319 d.Set("port", testResp.Port)
315 d.Set("trigger_rate", testResp.TriggerRate) 320 d.Set("trigger_rate", testResp.TriggerRate)
@@ -353,8 +358,8 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test {
353 if v, ok := d.GetOk("check_rate"); ok { 358 if v, ok := d.GetOk("check_rate"); ok {
354 test.CheckRate = v.(int) 359 test.CheckRate = v.(int)
355 } 360 }
356 if v, ok := d.GetOk("contact_id"); ok { 361 if v, ok := d.GetOk("contact_group"); ok {
357 test.ContactID = v.(int) 362 test.ContactGroup = castSetToSliceStrings(v.(*schema.Set).List())
358 } 363 }
359 if v, ok := d.GetOk("test_type"); ok { 364 if v, ok := d.GetOk("test_type"); ok {
360 test.TestType = v.(string) 365 test.TestType = v.(string)
@@ -417,7 +422,7 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test {
417 test.RealBrowser = v.(int) 422 test.RealBrowser = v.(int)
418 } 423 }
419 if v, ok := d.GetOk("test_tags"); ok { 424 if v, ok := d.GetOk("test_tags"); ok {
420 test.TestTags = v.(string) 425 test.TestTags = castSetToSliceStrings(v.(*schema.Set).List())
421 } 426 }
422 if v, ok := d.GetOk("status_codes"); ok { 427 if v, ok := d.GetOk("status_codes"); ok {
423 test.StatusCodes = v.(string) 428 test.StatusCodes = v.(string)