Merge pull request #7211 from hashicorp/mysql-provider-validation
provider/mysql: Empty Provider Credentials Caused Panic
This commit is contained in:
commit
42709f6088
|
@ -17,12 +17,28 @@ func Provider() terraform.ResourceProvider {
|
|||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("MYSQL_ENDPOINT", nil),
|
||||
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
|
||||
value := v.(string)
|
||||
if value == "" {
|
||||
errors = append(errors, fmt.Errorf("Endpoint must not be an empty string"))
|
||||
}
|
||||
|
||||
return
|
||||
},
|
||||
},
|
||||
|
||||
"username": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
DefaultFunc: schema.EnvDefaultFunc("MYSQL_USERNAME", nil),
|
||||
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
|
||||
value := v.(string)
|
||||
if value == "" {
|
||||
errors = append(errors, fmt.Errorf("Username must not be an empty string"))
|
||||
}
|
||||
|
||||
return
|
||||
},
|
||||
},
|
||||
|
||||
"password": &schema.Schema{
|
||||
|
|
Loading…
Reference in New Issue