Skip to content

Commit f2ab595

Browse files
authored
chore(tags): increase tag Value max length to 128 (#717)
Increases the max length of a tag's value to 128 characters.
1 parent e089157 commit f2ab595

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

client/tags.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ var (
1414
TagKeyValidationRegex = regexp.MustCompile(`^[a-z]{1,32}$`)
1515

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

2222
// Tag represents a key-value pair used for tagging resources.
@@ -32,7 +32,7 @@ func (t *Tag) Validate() error {
3232
}
3333
if !TagValueValidationRegex.MatchString(t.Value) {
3434
return fmt.Errorf("tag value %q is invalid: must begin with a lowercase letter,"+
35-
" be 1-32 characters long, and only contain lowercase alphanumeric characters, -, or /", t.Value)
35+
" be 1-128 characters long, and only contain lowercase alphanumeric characters, -, or /", t.Value)
3636
}
3737
return nil
3838
}

client/tags_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ func Test_TagValidation(t *testing.T) {
5050
"value too long": {
5151
Tag: client.Tag{
5252
Key: "env",
53-
Value: test.RandomString(50),
53+
Value: test.RandomString(129),
5454
},
5555
ExpectErr: true,
5656
},
5757
"mega invalid tag": {
5858
Tag: client.Tag{
5959
Key: "@SA!" + test.RandomString(50),
60-
Value: "!-395/" + test.RandomString(50),
60+
Value: "!-395/" + test.RandomString(156),
6161
},
6262
ExpectErr: true,
6363
},

internal/provider/tags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func tagsSchema() schema.MapAttribute {
4141
mapvalidator.ValueStringsAre(
4242
stringvalidator.RegexMatches(
4343
client.TagValueValidationRegex,
44-
"must begin with a lowercase letter, be between 1-32 characters long, and only contain lowercase alphanumeric characters, -, or /",
44+
"must begin with a lowercase letter, be between 1-128 characters long, and only contain lowercase alphanumeric characters, -, or /",
4545
),
4646
),
4747
},

0 commit comments

Comments
 (0)