diff options
author | Mat Schaffer <mat@schaffer.me> | 2018-02-01 16:15:21 +0900 |
---|---|---|
committer | Mat Schaffer <mat@schaffer.me> | 2018-02-01 16:15:21 +0900 |
commit | ef20d8d74891bfcfbf17088c4cd9c39cd1e347dd (patch) | |
tree | 4f30d86767b126d5f8ee67fa417382e4f0d7fa1d /statuscake/resource_statuscaketest.go | |
parent | 89027b6ac2e02ed5097e2aed6e2a5e0b0476d5f9 (diff) | |
download | terraform-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/resource_statuscaketest.go')
-rw-r--r-- | statuscake/resource_statuscaketest.go | 15 |
1 files changed, 5 insertions, 10 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) |