diff --git a/helper/schema/schema_test.go b/helper/schema/schema_test.go index 5ea108380..af747c17c 100644 --- a/helper/schema/schema_test.go +++ b/helper/schema/schema_test.go @@ -3469,6 +3469,7 @@ func TestSchemaMap_Validate(t *testing.T) { }, Err: true, }, + "ValidateFunc gets decoded type": { Schema: map[string]*Schema{ "maybe": &Schema{ @@ -3486,6 +3487,27 @@ func TestSchemaMap_Validate(t *testing.T) { "maybe": "true", }, }, + + "ValidateFunc is not called with a computed value": { + Schema: map[string]*Schema{ + "validate_me": &Schema{ + Type: TypeString, + Required: true, + ValidateFunc: func(v interface{}) (ws []string, es []error) { + es = append(es, fmt.Errorf("something is not right here")) + return + }, + }, + }, + Config: map[string]interface{}{ + "validate_me": "${var.foo}", + }, + Vars: map[string]string{ + "var.foo": config.UnknownVariableValue, + }, + + Err: false, + }, } for tn, tc := range cases {