Skip to content

Commit

Permalink
Merge pull request #143 from mjgpy3/fix-azure-table-name-requirement
Browse files Browse the repository at this point in the history
Fix azure table storage name length requirement.
  • Loading branch information
tombuildsstuff authored Jul 4, 2017
2 parents cc831be + b31307d commit 234c691
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions azurerm/resource_arm_storage_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ func validateArmStorageTableName(v interface{}, k string) (ws []string, errors [
"Table Storage %q cannot use the word `table`: %q",
k, value))
}
if !regexp.MustCompile(`^[A-Za-z][A-Za-z0-9]{6,63}$`).MatchString(value) {
if !regexp.MustCompile(`^[A-Za-z][A-Za-z0-9]{2,62}$`).MatchString(value) {
errors = append(errors, fmt.Errorf(
"Table Storage %q cannot begin with a numeric character, only alphanumeric characters are allowed and must be between 6 and 63 characters long: %q",
"Table Storage %q cannot begin with a numeric character, only alphanumeric characters are allowed and must be between 3 and 63 characters long: %q",
k, value))
}

Expand Down
4 changes: 3 additions & 1 deletion azurerm/resource_arm_storage_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ func TestValidateArmStorageTableName(t *testing.T) {
"mytable",
"myTable",
"MYTABLE",
"tbl",
strings.Repeat("w", 63),
}
for _, v := range validNames {
_, errors := validateArmStorageTableName(v, "name")
Expand All @@ -206,7 +208,7 @@ func TestValidateArmStorageTableName(t *testing.T) {
"invalid_name",
"invalid!",
"ww",
strings.Repeat("w", 65),
strings.Repeat("w", 64),
}
for _, v := range invalidNames {
_, errors := validateArmStorageTableName(v, "name")
Expand Down

0 comments on commit 234c691

Please sign in to comment.