]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/commitdiff
Update test_tag handling to be a proper list of strings
authorMat Schaffer <mat@schaffer.me>
Fri, 27 Jul 2018 08:17:26 +0000 (17:17 +0900)
committerMat Schaffer <mat@schaffer.me>
Fri, 27 Jul 2018 08:17:26 +0000 (17:17 +0900)
statuscake/resource_statuscaketest.go
statuscake/resource_statuscaketest_test.go
website/docs/r/test.html.markdown

index d7d3f36c2d857228e2313b0fd62720fe6d99081f..866cdce435480f7b9bb1d3049cf7411a0feb2ae9 100644 (file)
@@ -94,6 +94,7 @@ func resourceStatusCakeTest() *schema.Resource {
                                Optional: true,
                                Default:  5,
                        },
+
                        "custom_header": {
                                Type:     schema.TypeString,
                                Optional: true,
@@ -178,8 +179,10 @@ func resourceStatusCakeTest() *schema.Resource {
                        },
 
                        "test_tags": {
-                               Type:     schema.TypeString,
+                               Type:     schema.TypeSet,
+                               Elem:     &schema.Schema{Type: schema.TypeString},
                                Optional: true,
+                               Set:      schema.HashString,
                        },
 
                        "status_codes": {
@@ -240,7 +243,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error {
                FindString:     d.Get("find_string").(string),
                DoNotFind:      d.Get("do_not_find").(bool),
                RealBrowser:    d.Get("real_browser").(int),
-               TestTags:       d.Get("test_tags").(string),
+               TestTags:       castSetToSliceStrings(d.Get("test_tags").(*schema.Set).List()),
                StatusCodes:    d.Get("status_codes").(string),
                UseJar:         d.Get("use_jar").(int),
                PostRaw:        d.Get("post_raw").(string),
@@ -417,7 +420,7 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test {
                test.RealBrowser = v.(int)
        }
        if v, ok := d.GetOk("test_tags"); ok {
-               test.TestTags = v.(string)
+               test.TestTags = castSetToSliceStrings(v.(*schema.Set).List())
        }
        if v, ok := d.GetOk("status_codes"); ok {
                test.StatusCodes = v.(string)
index 8bcbb36a9cf1db5a71da66c90a5a1392a8907961..c10b5d3b70fc53363ce741296c067fa4c4570808 100644 (file)
@@ -91,7 +91,7 @@ func TestAccStatusCake_withUpdate(t *testing.T) {
                                        resource.TestCheckResourceAttr("statuscake_test.google", "find_string", "string15212"),
                                        resource.TestCheckResourceAttr("statuscake_test.google", "do_not_find", "false"),
                                        resource.TestCheckResourceAttr("statuscake_test.google", "real_browser", "1"),
-                                       resource.TestCheckResourceAttr("statuscake_test.google", "test_tags", "string8191"),
+                                       resource.TestCheckResourceAttr("statuscake_test.google", "test_tags.#", "1"),
                                        resource.TestCheckResourceAttr("statuscake_test.google", "status_codes", "string23065"),
                                        resource.TestCheckResourceAttr("statuscake_test.google", "use_jar", "1"),
                                        resource.TestCheckResourceAttr("statuscake_test.google", "post_raw", "string32096"),
@@ -261,7 +261,7 @@ resource "statuscake_test" "google" {
        find_string = "string15212"
        do_not_find = false
        real_browser = 1
-       test_tags = "string8191"
+       test_tags = ["string8191"]
        status_codes = "string23065"
        use_jar = 1
        post_raw = "string32096"
index b1547732dc8a77641de8c72e8d506f7ed12781a4..45e904a0317a005402155390ebc9fcc58e6b6289 100644 (file)
@@ -50,7 +50,7 @@ The following arguments are supported:
 * `find_string` - (Optional) A string that should either be found or not found.
 * `do_not_find` - (Optional) If the above string should be found to trigger a alert. 1 = will trigger if find_string found.
 * `real_browser` - (Optional) Use 1 to TURN OFF real browser testing.
-* `test_tags` - (Optional) Tags should be seperated by a comma - no spacing between tags (this,is,a set,of,tags).
+* `test_tags` - (Optional) Set test tags, must be array of strings.
 * `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".
 * `use_jar` - (Optional) Set to true to enable the Cookie Jar. Required for some redirects. Default is false.
 * `post_raw` - (Optional) Use to populate the RAW POST data field on the test.