diff --git a/helper/schema/schema.go b/helper/schema/schema.go index 5b398fd160..4a3e146b60 100644 --- a/helper/schema/schema.go +++ b/helper/schema/schema.go @@ -1093,9 +1093,10 @@ func checkKeysAgainstSchemaFlags(k string, keys []string, topSchemaMap schemaMap return nil } +var validFieldNameRe = regexp.MustCompile("^[a-z0-9_]+$") + func isValidFieldName(name string) bool { - re := regexp.MustCompile("^[a-z0-9_]+$") - return re.MatchString(name) + return validFieldNameRe.MatchString(name) } // resourceDiffer is an interface that is used by the private diff functions.