aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMat Schaffer <mat@schaffer.me>2018-07-27 17:17:26 +0900
committerMat Schaffer <mat@schaffer.me>2018-07-27 17:17:26 +0900
commitbc2bde6b20d0b6a7a0e1edd0b6a4e726c446d7c6 (patch)
tree9bfd0db7c306d7b79052a6323ecfc25ae5f07482
parentccc9fb69b8f1ebaaf871ad1561052d84a9ccd3a5 (diff)
downloadterraform-provider-statuscake-bc2bde6b20d0b6a7a0e1edd0b6a4e726c446d7c6.tar.gz
terraform-provider-statuscake-bc2bde6b20d0b6a7a0e1edd0b6a4e726c446d7c6.tar.zst
terraform-provider-statuscake-bc2bde6b20d0b6a7a0e1edd0b6a4e726c446d7c6.zip
Update test_tag handling to be a proper list of strings
-rw-r--r--statuscake/resource_statuscaketest.go9
-rw-r--r--statuscake/resource_statuscaketest_test.go4
-rw-r--r--website/docs/r/test.html.markdown2
3 files changed, 9 insertions, 6 deletions
diff --git a/statuscake/resource_statuscaketest.go b/statuscake/resource_statuscaketest.go
index d7d3f36..866cdce 100644
--- a/statuscake/resource_statuscaketest.go
+++ b/statuscake/resource_statuscaketest.go
@@ -94,6 +94,7 @@ func resourceStatusCakeTest() *schema.Resource {
94 Optional: true, 94 Optional: true,
95 Default: 5, 95 Default: 5,
96 }, 96 },
97
97 "custom_header": { 98 "custom_header": {
98 Type: schema.TypeString, 99 Type: schema.TypeString,
99 Optional: true, 100 Optional: true,
@@ -178,8 +179,10 @@ func resourceStatusCakeTest() *schema.Resource {
178 }, 179 },
179 180
180 "test_tags": { 181 "test_tags": {
181 Type: schema.TypeString, 182 Type: schema.TypeSet,
183 Elem: &schema.Schema{Type: schema.TypeString},
182 Optional: true, 184 Optional: true,
185 Set: schema.HashString,
183 }, 186 },
184 187
185 "status_codes": { 188 "status_codes": {
@@ -240,7 +243,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error {
240 FindString: d.Get("find_string").(string), 243 FindString: d.Get("find_string").(string),
241 DoNotFind: d.Get("do_not_find").(bool), 244 DoNotFind: d.Get("do_not_find").(bool),
242 RealBrowser: d.Get("real_browser").(int), 245 RealBrowser: d.Get("real_browser").(int),
243 TestTags: d.Get("test_tags").(string), 246 TestTags: castSetToSliceStrings(d.Get("test_tags").(*schema.Set).List()),
244 StatusCodes: d.Get("status_codes").(string), 247 StatusCodes: d.Get("status_codes").(string),
245 UseJar: d.Get("use_jar").(int), 248 UseJar: d.Get("use_jar").(int),
246 PostRaw: d.Get("post_raw").(string), 249 PostRaw: d.Get("post_raw").(string),
@@ -417,7 +420,7 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test {
417 test.RealBrowser = v.(int) 420 test.RealBrowser = v.(int)
418 } 421 }
419 if v, ok := d.GetOk("test_tags"); ok { 422 if v, ok := d.GetOk("test_tags"); ok {
420 test.TestTags = v.(string) 423 test.TestTags = castSetToSliceStrings(v.(*schema.Set).List())
421 } 424 }
422 if v, ok := d.GetOk("status_codes"); ok { 425 if v, ok := d.GetOk("status_codes"); ok {
423 test.StatusCodes = v.(string) 426 test.StatusCodes = v.(string)
diff --git a/statuscake/resource_statuscaketest_test.go b/statuscake/resource_statuscaketest_test.go
index 8bcbb36..c10b5d3 100644
--- a/statuscake/resource_statuscaketest_test.go
+++ b/statuscake/resource_statuscaketest_test.go
@@ -91,7 +91,7 @@ func TestAccStatusCake_withUpdate(t *testing.T) {
91 resource.TestCheckResourceAttr("statuscake_test.google", "find_string", "string15212"), 91 resource.TestCheckResourceAttr("statuscake_test.google", "find_string", "string15212"),
92 resource.TestCheckResourceAttr("statuscake_test.google", "do_not_find", "false"), 92 resource.TestCheckResourceAttr("statuscake_test.google", "do_not_find", "false"),
93 resource.TestCheckResourceAttr("statuscake_test.google", "real_browser", "1"), 93 resource.TestCheckResourceAttr("statuscake_test.google", "real_browser", "1"),
94 resource.TestCheckResourceAttr("statuscake_test.google", "test_tags", "string8191"), 94 resource.TestCheckResourceAttr("statuscake_test.google", "test_tags.#", "1"),
95 resource.TestCheckResourceAttr("statuscake_test.google", "status_codes", "string23065"), 95 resource.TestCheckResourceAttr("statuscake_test.google", "status_codes", "string23065"),
96 resource.TestCheckResourceAttr("statuscake_test.google", "use_jar", "1"), 96 resource.TestCheckResourceAttr("statuscake_test.google", "use_jar", "1"),
97 resource.TestCheckResourceAttr("statuscake_test.google", "post_raw", "string32096"), 97 resource.TestCheckResourceAttr("statuscake_test.google", "post_raw", "string32096"),
@@ -261,7 +261,7 @@ resource "statuscake_test" "google" {
261 find_string = "string15212" 261 find_string = "string15212"
262 do_not_find = false 262 do_not_find = false
263 real_browser = 1 263 real_browser = 1
264 test_tags = "string8191" 264 test_tags = ["string8191"]
265 status_codes = "string23065" 265 status_codes = "string23065"
266 use_jar = 1 266 use_jar = 1
267 post_raw = "string32096" 267 post_raw = "string32096"
diff --git a/website/docs/r/test.html.markdown b/website/docs/r/test.html.markdown
index b154773..45e904a 100644
--- a/website/docs/r/test.html.markdown
+++ b/website/docs/r/test.html.markdown
@@ -50,7 +50,7 @@ The following arguments are supported:
50* `find_string` - (Optional) A string that should either be found or not found. 50* `find_string` - (Optional) A string that should either be found or not found.
51* `do_not_find` - (Optional) If the above string should be found to trigger a alert. 1 = will trigger if find_string found. 51* `do_not_find` - (Optional) If the above string should be found to trigger a alert. 1 = will trigger if find_string found.
52* `real_browser` - (Optional) Use 1 to TURN OFF real browser testing. 52* `real_browser` - (Optional) Use 1 to TURN OFF real browser testing.
53* `test_tags` - (Optional) Tags should be seperated by a comma - no spacing between tags (this,is,a set,of,tags). 53* `test_tags` - (Optional) Set test tags, must be array of strings.
54* `status_codes` - (Optional) Comma Seperated List of StatusCodes to Trigger Error on. Defaults are "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, 408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 521, 522, 523, 524, 520, 598, 599". 54* `status_codes` - (Optional) Comma Seperated List of StatusCodes to Trigger Error on. Defaults are "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, 408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 521, 522, 523, 524, 520, 598, 599".
55* `use_jar` - (Optional) Set to true to enable the Cookie Jar. Required for some redirects. Default is false. 55* `use_jar` - (Optional) Set to true to enable the Cookie Jar. Required for some redirects. Default is false.
56* `post_raw` - (Optional) Use to populate the RAW POST data field on the test. 56* `post_raw` - (Optional) Use to populate the RAW POST data field on the test.