aboutsummaryrefslogtreecommitdiffhomepage
path: root/statuscake
diff options
context:
space:
mode:
authorMat Schaffer <mat@schaffer.me>2018-02-01 16:15:21 +0900
committerMat Schaffer <mat@schaffer.me>2018-02-01 16:15:21 +0900
commitef20d8d74891bfcfbf17088c4cd9c39cd1e347dd (patch)
tree4f30d86767b126d5f8ee67fa417382e4f0d7fa1d /statuscake
parent89027b6ac2e02ed5097e2aed6e2a5e0b0476d5f9 (diff)
downloadterraform-provider-statuscake-ef20d8d74891bfcfbf17088c4cd9c39cd1e347dd.tar.gz
terraform-provider-statuscake-ef20d8d74891bfcfbf17088c4cd9c39cd1e347dd.tar.zst
terraform-provider-statuscake-ef20d8d74891bfcfbf17088c4cd9c39cd1e347dd.zip
Don't attempt to set or verify values which aren't present in the details response
The `TestCheckResourceAttr` tests can stay since they rely on the state from the previous apply.
Diffstat (limited to 'statuscake')
-rw-r--r--statuscake/resource_statuscaketest.go15
-rw-r--r--statuscake/resource_statuscaketest_test.go18
2 files changed, 5 insertions, 28 deletions
diff --git a/statuscake/resource_statuscaketest.go b/statuscake/resource_statuscaketest.go
index b2b0c68..d7d3f36 100644
--- a/statuscake/resource_statuscaketest.go
+++ b/statuscake/resource_statuscaketest.go
@@ -314,24 +314,19 @@ func ReadTest(d *schema.ResourceData, meta interface{}) error {
314 d.Set("port", testResp.Port) 314 d.Set("port", testResp.Port)
315 d.Set("trigger_rate", testResp.TriggerRate) 315 d.Set("trigger_rate", testResp.TriggerRate)
316 d.Set("custom_header", testResp.CustomHeader) 316 d.Set("custom_header", testResp.CustomHeader)
317 d.Set("user_agent", testResp.UserAgent)
318 d.Set("status", testResp.Status) 317 d.Set("status", testResp.Status)
319 d.Set("uptime", testResp.Uptime) 318 d.Set("uptime", testResp.Uptime)
320 if err := d.Set("node_locations", considerEmptyStringAsEmptyArray(testResp.NodeLocations)); err != nil { 319 if err := d.Set("node_locations", considerEmptyStringAsEmptyArray(testResp.NodeLocations)); err != nil {
321 return fmt.Errorf("[WARN] Error setting node locations: %s", err) 320 return fmt.Errorf("[WARN] Error setting node locations: %s", err)
322 } 321 }
323 d.Set("ping_url", testResp.PingURL)
324 d.Set("basic_user", testResp.BasicUser)
325 d.Set("basic_pass", testResp.BasicPass)
326 d.Set("public", testResp.Public)
327 d.Set("logo_image", testResp.LogoImage) 322 d.Set("logo_image", testResp.LogoImage)
328 d.Set("branding", testResp.Branding) 323 // Even after WebsiteHost is set, the API returns ""
329 d.Set("website_host", testResp.WebsiteHost) 324 // API docs aren't clear on usage will only override state if we get a non-empty value back
330 d.Set("virus", testResp.Virus) 325 if testResp.WebsiteHost != "" {
326 d.Set("website_host", testResp.WebsiteHost)
327 }
331 d.Set("find_string", testResp.FindString) 328 d.Set("find_string", testResp.FindString)
332 d.Set("do_not_find", testResp.DoNotFind) 329 d.Set("do_not_find", testResp.DoNotFind)
333 d.Set("real_browser", testResp.RealBrowser)
334 d.Set("test_tags", testResp.TestTags)
335 d.Set("status_codes", testResp.StatusCodes) 330 d.Set("status_codes", testResp.StatusCodes)
336 d.Set("use_jar", testResp.UseJar) 331 d.Set("use_jar", testResp.UseJar)
337 d.Set("post_raw", testResp.PostRaw) 332 d.Set("post_raw", testResp.PostRaw)
diff --git a/statuscake/resource_statuscaketest_test.go b/statuscake/resource_statuscaketest_test.go
index 555cff1..da3a349 100644
--- a/statuscake/resource_statuscaketest_test.go
+++ b/statuscake/resource_statuscaketest_test.go
@@ -166,8 +166,6 @@ func testAccTestCheckAttributes(rn string, test *statuscake.Test) resource.TestC
166 err = check(key, value, strconv.Itoa(test.TriggerRate)) 166 err = check(key, value, strconv.Itoa(test.TriggerRate))
167 case "custom_header": 167 case "custom_header":
168 err = check(key, value, test.CustomHeader) 168 err = check(key, value, test.CustomHeader)
169 case "user_agent":
170 err = check(key, value, test.UserAgent)
171 case "node_locations": 169 case "node_locations":
172 for _, tv := range test.NodeLocations { 170 for _, tv := range test.NodeLocations {
173 err = check(key, value, tv) 171 err = check(key, value, tv)
@@ -175,30 +173,14 @@ func testAccTestCheckAttributes(rn string, test *statuscake.Test) resource.TestC
175 return err 173 return err
176 } 174 }
177 } 175 }
178 case "ping_url":
179 err = check(key, value, test.PingURL)
180 case "basic_user":
181 err = check(key, value, test.BasicUser)
182 case "basic_pass":
183 err = check(key, value, test.BasicPass)
184 case "public": 176 case "public":
185 err = check(key, value, strconv.Itoa(test.Public)) 177 err = check(key, value, strconv.Itoa(test.Public))
186 case "logo_image": 178 case "logo_image":
187 err = check(key, value, test.LogoImage) 179 err = check(key, value, test.LogoImage)
188 case "branding":
189 err = check(key, value, strconv.Itoa(test.Branding))
190 case "website_host":
191 err = check(key, value, test.WebsiteHost)
192 case "virus":
193 err = check(key, value, strconv.Itoa(test.Virus))
194 case "find_string": 180 case "find_string":
195 err = check(key, value, test.FindString) 181 err = check(key, value, test.FindString)
196 case "do_not_find": 182 case "do_not_find":
197 err = check(key, value, strconv.FormatBool(test.DoNotFind)) 183 err = check(key, value, strconv.FormatBool(test.DoNotFind))
198 case "real_browser":
199 err = check(key, value, strconv.Itoa(test.RealBrowser))
200 case "test_tags":
201 err = check(key, value, test.TestTags)
202 case "status_codes": 184 case "status_codes":
203 err = check(key, value, test.StatusCodes) 185 err = check(key, value, test.StatusCodes)
204 case "use_jar": 186 case "use_jar":