Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ var (
TagKeyValidationRegex = regexp.MustCompile(`^[a-z]{1,32}$`)

// TagValueValidationRegex is the regex used to validate tag values.
// It must begin with a lowercase letter, be between 1 and 32 characters long,
// It must begin with a lowercase letter, be between 1 and 128 characters long,
// and only contain alphanumeric characters, -, or /.
TagValueValidationRegex = regexp.MustCompile(`^[a-z][a-z0-9\/-]{1,32}$`)
TagValueValidationRegex = regexp.MustCompile(`^[a-z][a-z0-9\/-]{1,128}$`)
)

// Tag represents a key-value pair used for tagging resources.
Expand All @@ -32,7 +32,7 @@ func (t *Tag) Validate() error {
}
if !TagValueValidationRegex.MatchString(t.Value) {
return fmt.Errorf("tag value %q is invalid: must begin with a lowercase letter,"+
" be 1-32 characters long, and only contain lowercase alphanumeric characters, -, or /", t.Value)
" be 1-128 characters long, and only contain lowercase alphanumeric characters, -, or /", t.Value)
}
return nil
}
4 changes: 2 additions & 2 deletions client/tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ func Test_TagValidation(t *testing.T) {
"value too long": {
Tag: client.Tag{
Key: "env",
Value: test.RandomString(50),
Value: test.RandomString(129),
},
ExpectErr: true,
},
"mega invalid tag": {
Tag: client.Tag{
Key: "@SA!" + test.RandomString(50),
Value: "!-395/" + test.RandomString(50),
Value: "!-395/" + test.RandomString(156),
},
ExpectErr: true,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func tagsSchema() schema.MapAttribute {
mapvalidator.ValueStringsAre(
stringvalidator.RegexMatches(
client.TagValueValidationRegex,
"must begin with a lowercase letter, be between 1-32 characters long, and only contain lowercase alphanumeric characters, -, or /",
"must begin with a lowercase letter, be between 1-128 characters long, and only contain lowercase alphanumeric characters, -, or /",
),
),
},
Expand Down