diff --git a/auth0/resource_auth0_rule.go b/auth0/resource_auth0_rule.go index b8f7fe9f..ec12f097 100644 --- a/auth0/resource_auth0_rule.go +++ b/auth0/resource_auth0_rule.go @@ -24,7 +24,7 @@ func newRule() *schema.Resource { Type: schema.TypeString, Required: true, ValidateFunc: validation.StringMatch( - regexp.MustCompile("^[a-z|A-Z]+[a-z|A-Z\\-\\s]+[a-z|A-Z]+$"), + regexp.MustCompile("^[^\\s-][\\w-]+[^\\s-]$"), "Can only contain alphanumeric characters, spaces and '-'. "+ "Can neither start nor end with '-' or spaces."), }, diff --git a/auth0/resource_auth0_rule_test.go b/auth0/resource_auth0_rule_test.go index ad984047..18bc320c 100644 --- a/auth0/resource_auth0_rule_test.go +++ b/auth0/resource_auth0_rule_test.go @@ -17,7 +17,7 @@ func TestAccRule(t *testing.T) { resource.TestStep{ Config: testAccRule, Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("auth0_rule.my_rule", "name", "Acceptance-Test-Rule"), + resource.TestCheckResourceAttr("auth0_rule.my_rule", "name", "auth0-authorization-extension"), resource.TestCheckResourceAttr("auth0_rule.my_rule", "script", "function (user, context, callback) { callback(null, user, context); }"), resource.TestCheckResourceAttr("auth0_rule.my_rule", "enabled", "true"), ), @@ -30,7 +30,7 @@ const testAccRule = ` provider "auth0" {} resource "auth0_rule" "my_rule" { - name = "Acceptance-Test-Rule" + name = "auth0-authorization-extension" script = "function (user, context, callback) { callback(null, user, context); }" enabled = true }