diff --git a/azurerm/resource_arm_storage_table.go b/azurerm/resource_arm_storage_table.go index 3db39165a93e..f82ec1d8338c 100644 --- a/azurerm/resource_arm_storage_table.go +++ b/azurerm/resource_arm_storage_table.go @@ -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)) } diff --git a/azurerm/resource_arm_storage_table_test.go b/azurerm/resource_arm_storage_table_test.go index 33cc095aa738..f3b99f5441ec 100644 --- a/azurerm/resource_arm_storage_table_test.go +++ b/azurerm/resource_arm_storage_table_test.go @@ -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") @@ -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")