diff --git a/internal/services/apimanagement/validate/api_management.go b/internal/services/apimanagement/validate/api_management.go index 7888be4cdd31..e979bb92cba1 100644 --- a/internal/services/apimanagement/validate/api_management.go +++ b/internal/services/apimanagement/validate/api_management.go @@ -76,7 +76,7 @@ func ApiManagementApiName(v interface{}, k string) (ws []string, es []error) { func ApiManagementApiPath(v interface{}, k string) (ws []string, es []error) { value := v.(string) - if matched := regexp.MustCompile(`^(?:|[\w.][\w-/.:]{0,398}[\w-])$`).Match([]byte(value)); !matched { + if matched := regexp.MustCompile(`^(?:|[\w]|[\w.][\w-/.:]{0,398}[\w-])$`).Match([]byte(value)); !matched { es = append(es, fmt.Errorf("%q may only be up to 400 characters in length, not start or end with `/` and only contain valid url characters", k)) } return ws, es diff --git a/internal/services/apimanagement/validate/api_management_test.go b/internal/services/apimanagement/validate/api_management_test.go index f8bbb7af021d..0a81d9e0411a 100644 --- a/internal/services/apimanagement/validate/api_management_test.go +++ b/internal/services/apimanagement/validate/api_management_test.go @@ -137,6 +137,10 @@ func TestAzureRMApiManagementApiPath_validation(t *testing.T) { Value: "api1:sub", ErrCount: 0, }, + { + Value: "a", + ErrCount: 0, + }, { Value: s.Repeat("x", 401), ErrCount: 1,