aboutsummaryrefslogtreecommitdiffhomepage
path: root/statuscake
diff options
context:
space:
mode:
authorAndrew N Golovkov <andrew@callstats.io>2018-01-16 16:11:43 +0200
committerAndrew N Golovkov <andrew@callstats.io>2018-01-17 14:59:24 +0200
commita609749989d4ea67354ac5a464ce42a7b807b869 (patch)
treebdd4171e3e8a3d4c0e9a8c9a813319673555ccac /statuscake
parent754f142077413d1cfd1e3c8e2fc3f3c0c341ca69 (diff)
downloadterraform-provider-statuscake-a609749989d4ea67354ac5a464ce42a7b807b869.tar.gz
terraform-provider-statuscake-a609749989d4ea67354ac5a464ce42a7b807b869.tar.zst
terraform-provider-statuscake-a609749989d4ea67354ac5a464ce42a7b807b869.zip
`status` and `uptime` params is calculated
Diffstat (limited to 'statuscake')
-rw-r--r--statuscake/resource_statuscaketest.go12
-rw-r--r--statuscake/resource_statuscaketest_test.go6
2 files changed, 4 insertions, 14 deletions
diff --git a/statuscake/resource_statuscaketest.go b/statuscake/resource_statuscaketest.go
index 27cf9bf..50e16f9 100644
--- a/statuscake/resource_statuscaketest.go
+++ b/statuscake/resource_statuscaketest.go
@@ -88,12 +88,12 @@ func resourceStatusCakeTest() *schema.Resource {
88 88
89 "status": { 89 "status": {
90 Type: schema.TypeString, 90 Type: schema.TypeString,
91 Optional: true, 91 Computed: true,
92 }, 92 },
93 93
94 "uptime": { 94 "uptime": {
95 Type: schema.TypeFloat, 95 Type: schema.TypeFloat,
96 Optional: true, 96 Computed: true,
97 }, 97 },
98 98
99 "node_locations": { 99 "node_locations": {
@@ -240,6 +240,8 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error {
240 } 240 }
241 241
242 d.Set("test_id", fmt.Sprintf("%d", response.TestID)) 242 d.Set("test_id", fmt.Sprintf("%d", response.TestID))
243 d.Set("status", response.Status)
244 d.Set("uptime", fmt.Sprintf("%.3f", response.Uptime))
243 d.SetId(fmt.Sprintf("%d", response.TestID)) 245 d.SetId(fmt.Sprintf("%d", response.TestID))
244 246
245 return ReadTest(d, meta) 247 return ReadTest(d, meta)
@@ -365,12 +367,6 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test {
365 if v, ok := d.GetOk("user_agent"); ok { 367 if v, ok := d.GetOk("user_agent"); ok {
366 test.UserAgent = v.(string) 368 test.UserAgent = v.(string)
367 } 369 }
368 if v, ok := d.GetOk("status"); ok {
369 test.Status = v.(string)
370 }
371 if v, ok := d.GetOk("uptime"); ok {
372 test.Uptime = v.(float64)
373 }
374 if v, ok := d.GetOk("node_locations"); ok { 370 if v, ok := d.GetOk("node_locations"); ok {
375 test.NodeLocations = v.([]string) 371 test.NodeLocations = v.([]string)
376 } 372 }
diff --git a/statuscake/resource_statuscaketest_test.go b/statuscake/resource_statuscaketest_test.go
index b39d23c..99acd04 100644
--- a/statuscake/resource_statuscaketest_test.go
+++ b/statuscake/resource_statuscaketest_test.go
@@ -171,10 +171,6 @@ func testAccTestCheckAttributes(rn string, test *statuscake.Test) resource.TestC
171 err = check(key, value, test.CustomHeader) 171 err = check(key, value, test.CustomHeader)
172 case "user_agent": 172 case "user_agent":
173 err = check(key, value, test.UserAgent) 173 err = check(key, value, test.UserAgent)
174 case "status":
175 err = check(key, value, test.Status)
176 case "uptime":
177 err = check(key, value, strconv.FormatFloat(test.Uptime, 'f', -1, 64))
178 case "node_locations": 174 case "node_locations":
179 for _, tv := range test.NodeLocations { 175 for _, tv := range test.NodeLocations {
180 err = check(key, value, tv) 176 err = check(key, value, tv)
@@ -260,8 +256,6 @@ resource "statuscake_test" "google" {
260 trigger_rate = 20 256 trigger_rate = 20
261 custom_header = "{ \"Content-Type\": \"application/x-www-form-urlencoded\" }" 257 custom_header = "{ \"Content-Type\": \"application/x-www-form-urlencoded\" }"
262 user_agent = "string9988" 258 user_agent = "string9988"
263 status = "string22117"
264 uptime = 3498.27
265 node_locations = [ "string16045", "string19741", "string12122" ] 259 node_locations = [ "string16045", "string19741", "string12122" ]
266 ping_url = "string8410" 260 ping_url = "string8410"
267 basic_user = "string27052" 261 basic_user = "string27052"