Allowed values in error message

This commit is contained in:
Alexander Hellbom 2016-10-17 23:20:23 +02:00
parent effec42278
commit de9a1c146c
2 changed files with 11 additions and 5 deletions

View File

@ -31,10 +31,16 @@ func resourcePagerDutyUser() *schema.Resource {
Computed: true,
},
"role": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "user",
ValidateFunc: validateValueFunc([]string{"admin", "limited_user", "owner", "read_only_user", "user"}),
Type: schema.TypeString,
Optional: true,
Default: "user",
ValidateFunc: validateValueFunc([]string{
"admin",
"limited_user",
"owner",
"read_only_user",
"user",
}),
},
"job_title": &schema.Schema{
Type: schema.TypeString,

View File

@ -19,7 +19,7 @@ func validateValueFunc(values []string) schema.SchemaValidateFunc {
}
if !valid {
errors = append(errors, fmt.Errorf("%s is an invalid value for argument %s", value, k))
errors = append(errors, fmt.Errorf("%s is an invalid value for argument %s. Must be one of %v", value, k, values))
}
return
}