diff --git a/splunk/resource_splunk_configs_conf.go b/splunk/resource_splunk_configs_conf.go index b24194e2..16e001d1 100644 --- a/splunk/resource_splunk_configs_conf.go +++ b/splunk/resource_splunk_configs_conf.go @@ -32,7 +32,7 @@ func configsConf() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9_\-.]+/[a-zA-Z0-9_\-.]+`), "A '/' separated string consisting of {conf_file_name}/{stanza_name} ex. props/custom_stanza"), + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9_\-.]+/[a-zA-Z0-9_\-.:/]+`), "A '/' separated string consisting of {conf_file_name}/{stanza_name} ex. props/custom_stanza"), Description: `A '/' separated string consisting of {conf_file_name}/{stanza_name} ex. props/custom_stanza`, }, "acl": aclSchema(), diff --git a/splunk/resource_splunk_configs_conf_test.go b/splunk/resource_splunk_configs_conf_test.go index 09846842..50dff922 100644 --- a/splunk/resource_splunk_configs_conf_test.go +++ b/splunk/resource_splunk_configs_conf_test.go @@ -60,6 +60,59 @@ func TestAccCreateSplunkConfigsConf(t *testing.T) { }) } +const newConfigsConfSpecialChars = ` +resource "splunk_configs_conf" "tftest-stanza-special-chars" { + name = "tf_test/sqs://tftest_stanza_special_chars" + variables = { + "disabled": "false" + "key": "value" + } +} +` + +const updateConfigsConfSpecialChars = ` +resource "splunk_configs_conf" "tftest-stanza-special-chars" { + name = "tf_test/sqs://tftest_stanza_special_chars" + variables = { + "disabled": "false" + "key": "new-value" + } +} +` + +func TestAccCreateSplunkConfigsConfSpecialChars(t *testing.T) { + resourceName := "splunk_configs_conf.tftest-stanza-special-chars" + resource.Test(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + }, + Providers: testAccProviders, + CheckDestroy: testAccSplunkConfigsConfDestroyResources, + Steps: []resource.TestStep{ + { + Config: newConfigsConfSpecialChars, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "variables.%", "2"), + resource.TestCheckResourceAttr(resourceName, "variables.key", "value"), + ), + }, + { + Config: updateConfigsConfSpecialChars, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(resourceName, "variables.%", "2"), + resource.TestCheckResourceAttr(resourceName, "variables.key", "new-value"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + + func testAccSplunkConfigsConfDestroyResources(s *terraform.State) error { client, err := newTestClient() if err != nil {