aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--resource_statuscaketest.go11
-rw-r--r--resource_statuscaketest_test.go5
2 files changed, 16 insertions, 0 deletions
diff --git a/resource_statuscaketest.go b/resource_statuscaketest.go
index 4912758..101ee83 100644
--- a/resource_statuscaketest.go
+++ b/resource_statuscaketest.go
@@ -70,6 +70,12 @@ func resourceStatusCakeTest() *schema.Resource {
70 Type: schema.TypeInt, 70 Type: schema.TypeInt,
71 Optional: true, 71 Optional: true,
72 }, 72 },
73
74 "trigger_rate": {
75 Type: schema.TypeInt,
76 Optional: true,
77 Default: 5,
78 },
73 }, 79 },
74 } 80 }
75} 81}
@@ -87,6 +93,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error {
87 ContactID: d.Get("contact_id").(int), 93 ContactID: d.Get("contact_id").(int),
88 Confirmation: d.Get("confirmations").(int), 94 Confirmation: d.Get("confirmations").(int),
89 Port: d.Get("port").(int), 95 Port: d.Get("port").(int),
96 TriggerRate: d.Get("trigger_rate").(int),
90 } 97 }
91 98
92 log.Printf("[DEBUG] Creating new StatusCake Test: %s", d.Get("website_name").(string)) 99 log.Printf("[DEBUG] Creating new StatusCake Test: %s", d.Get("website_name").(string))
@@ -151,6 +158,7 @@ func ReadTest(d *schema.ResourceData, meta interface{}) error {
151 d.Set("contact_id", testResp.ContactID) 158 d.Set("contact_id", testResp.ContactID)
152 d.Set("confirmations", testResp.Confirmation) 159 d.Set("confirmations", testResp.Confirmation)
153 d.Set("port", testResp.Port) 160 d.Set("port", testResp.Port)
161 d.Set("trigger_rate", testResp.TriggerRate)
154 162
155 return nil 163 return nil
156} 164}
@@ -193,6 +201,9 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test {
193 if v, ok := d.GetOk("port"); ok { 201 if v, ok := d.GetOk("port"); ok {
194 test.Port = v.(int) 202 test.Port = v.(int)
195 } 203 }
204 if v, ok := d.GetOk("trigger_rate"); ok {
205 test.TriggerRate = v.(int)
206 }
196 207
197 defaultStatusCodes := "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, " + 208 defaultStatusCodes := "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, " +
198 "408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, " + 209 "408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, " +
diff --git a/resource_statuscaketest_test.go b/resource_statuscaketest_test.go
index d38dc1c..f07fcc5 100644
--- a/resource_statuscaketest_test.go
+++ b/resource_statuscaketest_test.go
@@ -73,6 +73,7 @@ func TestAccStatusCake_withUpdate(t *testing.T) {
73 resource.TestCheckResourceAttr("statuscake_test.google", "timeout", "40"), 73 resource.TestCheckResourceAttr("statuscake_test.google", "timeout", "40"),
74 resource.TestCheckResourceAttr("statuscake_test.google", "contact_id", "0"), 74 resource.TestCheckResourceAttr("statuscake_test.google", "contact_id", "0"),
75 resource.TestCheckResourceAttr("statuscake_test.google", "confirmations", "0"), 75 resource.TestCheckResourceAttr("statuscake_test.google", "confirmations", "0"),
76 resource.TestCheckResourceAttr("statuscake_test.google", "trigger_rate", "20"),
76 ), 77 ),
77 }, 78 },
78 }, 79 },
@@ -139,6 +140,8 @@ func testAccTestCheckAttributes(rn string, test *statuscake.Test) resource.TestC
139 err = check(key, value, strconv.Itoa(test.ContactID)) 140 err = check(key, value, strconv.Itoa(test.ContactID))
140 case "confirmations": 141 case "confirmations":
141 err = check(key, value, strconv.Itoa(test.Confirmation)) 142 err = check(key, value, strconv.Itoa(test.Confirmation))
143 case "trigger_rate":
144 err = check(key, value, strconv.Itoa(test.TriggerRate))
142 } 145 }
143 146
144 if err != nil { 147 if err != nil {
@@ -170,6 +173,7 @@ resource "statuscake_test" "google" {
170 timeout = 10 173 timeout = 10
171 contact_id = 43402 174 contact_id = 43402
172 confirmations = 1 175 confirmations = 1
176 trigger_rate = 10
173} 177}
174` 178`
175 179
@@ -180,6 +184,7 @@ resource "statuscake_test" "google" {
180 test_type = "HTTP" 184 test_type = "HTTP"
181 check_rate = 500 185 check_rate = 500
182 paused = true 186 paused = true
187 trigger_rate = 20
183} 188}
184` 189`
185 190