mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Merge pull request #11383 from brad-larson/brad-fix-regexp-validation
Fix: Incorrect AWS Lambda Qualifier Regexp
This commit is contained in:
commit
e3c89da542
@ -251,7 +251,7 @@ func validateLambdaQualifier(v interface{}, k string) (ws []string, errors []err
|
|||||||
"%q cannot be longer than 128 characters: %q", k, value))
|
"%q cannot be longer than 128 characters: %q", k, value))
|
||||||
}
|
}
|
||||||
// http://docs.aws.amazon.com/lambda/latest/dg/API_AddPermission.html
|
// http://docs.aws.amazon.com/lambda/latest/dg/API_AddPermission.html
|
||||||
pattern := `^[a-zA-Z0-9$_]+$`
|
pattern := `^[a-zA-Z0-9$_-]+$`
|
||||||
if !regexp.MustCompile(pattern).MatchString(value) {
|
if !regexp.MustCompile(pattern).MatchString(value) {
|
||||||
errors = append(errors, fmt.Errorf(
|
errors = append(errors, fmt.Errorf(
|
||||||
"%q doesn't comply with restrictions (%q): %q",
|
"%q doesn't comply with restrictions (%q): %q",
|
||||||
|
@ -111,6 +111,8 @@ func TestValidateLambdaQualifier(t *testing.T) {
|
|||||||
"prod",
|
"prod",
|
||||||
"PROD",
|
"PROD",
|
||||||
"MyTestEnv",
|
"MyTestEnv",
|
||||||
|
"contains-dashes",
|
||||||
|
"contains_underscores",
|
||||||
"$LATEST",
|
"$LATEST",
|
||||||
}
|
}
|
||||||
for _, v := range validNames {
|
for _, v := range validNames {
|
||||||
|
Loading…
Reference in New Issue
Block a user