aboutsummaryrefslogtreecommitdiffhomepage
path: root/statuscake/resource_statuscaketest.go
diff options
context:
space:
mode:
authorMat Schaffer <mat@schaffer.me>2018-07-27 17:17:56 +0900
committerMat Schaffer <mat@schaffer.me>2018-07-27 17:17:56 +0900
commit4efdab4181cd2bfd243600def27f70f0580942a3 (patch)
tree99c7425a606bde644c5a924d158cbbf237130b52 /statuscake/resource_statuscaketest.go
parentbc2bde6b20d0b6a7a0e1edd0b6a4e726c446d7c6 (diff)
downloadterraform-provider-statuscake-4efdab4181cd2bfd243600def27f70f0580942a3.tar.gz
terraform-provider-statuscake-4efdab4181cd2bfd243600def27f70f0580942a3.tar.zst
terraform-provider-statuscake-4efdab4181cd2bfd243600def27f70f0580942a3.zip
Replace contact_id with contact_group
This allows for multiple contacts per test.
Diffstat (limited to 'statuscake/resource_statuscaketest.go')
-rw-r--r--statuscake/resource_statuscaketest.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/statuscake/resource_statuscaketest.go b/statuscake/resource_statuscaketest.go
index 866cdce..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": {
@@ -223,7 +225,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error {
223 TestType: d.Get("test_type").(string), 225 TestType: d.Get("test_type").(string),
224 Paused: d.Get("paused").(bool), 226 Paused: d.Get("paused").(bool),
225 Timeout: d.Get("timeout").(int), 227 Timeout: d.Get("timeout").(int),
226 ContactID: d.Get("contact_id").(int), 228 ContactGroup: castSetToSliceStrings(d.Get("contact_group").(*schema.Set).List()),
227 Confirmation: d.Get("confirmations").(int), 229 Confirmation: d.Get("confirmations").(int),
228 Port: d.Get("port").(int), 230 Port: d.Get("port").(int),
229 TriggerRate: d.Get("trigger_rate").(int), 231 TriggerRate: d.Get("trigger_rate").(int),
@@ -312,7 +314,7 @@ func ReadTest(d *schema.ResourceData, meta interface{}) error {
312 d.Set("test_type", testResp.TestType) 314 d.Set("test_type", testResp.TestType)
313 d.Set("paused", testResp.Paused) 315 d.Set("paused", testResp.Paused)
314 d.Set("timeout", testResp.Timeout) 316 d.Set("timeout", testResp.Timeout)
315 d.Set("contact_id", testResp.ContactID) 317 d.Set("contact_group", testResp.ContactGroup)
316 d.Set("confirmations", testResp.Confirmation) 318 d.Set("confirmations", testResp.Confirmation)
317 d.Set("port", testResp.Port) 319 d.Set("port", testResp.Port)
318 d.Set("trigger_rate", testResp.TriggerRate) 320 d.Set("trigger_rate", testResp.TriggerRate)
@@ -356,8 +358,8 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test {
356 if v, ok := d.GetOk("check_rate"); ok { 358 if v, ok := d.GetOk("check_rate"); ok {
357 test.CheckRate = v.(int) 359 test.CheckRate = v.(int)
358 } 360 }
359 if v, ok := d.GetOk("contact_id"); ok { 361 if v, ok := d.GetOk("contact_group"); ok {
360 test.ContactID = v.(int) 362 test.ContactGroup = castSetToSliceStrings(v.(*schema.Set).List())
361 } 363 }
362 if v, ok := d.GetOk("test_type"); ok { 364 if v, ok := d.GetOk("test_type"); ok {
363 test.TestType = v.(string) 365 test.TestType = v.(string)