Fix validation of spanner instance ID length (#3048)

Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
The Magician 2019-02-13 17:34:07 -08:00 committed by emily
parent bf10d4f553
commit 8bf6871696
2 changed files with 4 additions and 5 deletions

View File

@ -49,7 +49,7 @@ func resourceSpannerDatabase() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateRegexp(`^(?:[a-z](?:[-_a-z0-9]{0,28}[a-z0-9])?)$`),
ValidateFunc: validateRegexp(`^[a-z][a-z0-9_\-]*[a-z0-9]$`),
},
"ddl": {
Type: schema.TypeList,

View File

@ -52,16 +52,15 @@ func resourceSpannerInstance() *schema.Resource {
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
"display_name": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validateRegexp(`^(?:[a-zA-Z](?:[- _a-zA-Z0-9]{2,28}[a-zA-Z0-9])?)$`),
Type: schema.TypeString,
Required: true,
},
"name": {
Type: schema.TypeString,
Computed: true,
Optional: true,
ForceNew: true,
ValidateFunc: validateRegexp(`^(?:[a-z](?:[-_a-z0-9]{4,28}[a-z0-9])?)$`),
ValidateFunc: validateRegexp(`^[a-z][-a-z0-9]*[a-z0-9]$`),
},
"labels": {
Type: schema.TypeMap,