From bc2bde6b20d0b6a7a0e1edd0b6a4e726c446d7c6 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Fri, 27 Jul 2018 17:17:26 +0900 Subject: Update test_tag handling to be a proper list of strings --- statuscake/resource_statuscaketest.go | 9 ++++++--- statuscake/resource_statuscaketest_test.go | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'statuscake') 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 { 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) 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) { 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" -- cgit v1.2.3