From ef20d8d74891bfcfbf17088c4cd9c39cd1e347dd Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Thu, 1 Feb 2018 16:15:21 +0900 Subject: 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. --- statuscake/resource_statuscaketest.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'statuscake/resource_statuscaketest.go') 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 { d.Set("port", testResp.Port) d.Set("trigger_rate", testResp.TriggerRate) d.Set("custom_header", testResp.CustomHeader) - d.Set("user_agent", testResp.UserAgent) d.Set("status", testResp.Status) d.Set("uptime", testResp.Uptime) if err := d.Set("node_locations", considerEmptyStringAsEmptyArray(testResp.NodeLocations)); err != nil { return fmt.Errorf("[WARN] Error setting node locations: %s", err) } - d.Set("ping_url", testResp.PingURL) - d.Set("basic_user", testResp.BasicUser) - d.Set("basic_pass", testResp.BasicPass) - d.Set("public", testResp.Public) d.Set("logo_image", testResp.LogoImage) - d.Set("branding", testResp.Branding) - d.Set("website_host", testResp.WebsiteHost) - d.Set("virus", testResp.Virus) + // Even after WebsiteHost is set, the API returns "" + // API docs aren't clear on usage will only override state if we get a non-empty value back + if testResp.WebsiteHost != "" { + d.Set("website_host", testResp.WebsiteHost) + } d.Set("find_string", testResp.FindString) d.Set("do_not_find", testResp.DoNotFind) - d.Set("real_browser", testResp.RealBrowser) - d.Set("test_tags", testResp.TestTags) d.Set("status_codes", testResp.StatusCodes) d.Set("use_jar", testResp.UseJar) d.Set("post_raw", testResp.PostRaw) -- cgit v1.2.3