github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/builtin/providers/rundeck/util.go (about) 1 package rundeck 2 3 import ( 4 "fmt" 5 6 "github.com/hashicorp/terraform/helper/schema" 7 ) 8 9 func validateValueFunc(values []string) schema.SchemaValidateFunc { 10 return func(v interface{}, k string) (we []string, errors []error) { 11 value := v.(string) 12 valid := false 13 for _, role := range values { 14 if value == role { 15 valid = true 16 break 17 } 18 } 19 20 if !valid { 21 errors = append(errors, fmt.Errorf("%s is an invalid value for argument %s", value, k)) 22 } 23 return 24 } 25 }