add failing test for GH-12253

This commit is contained in:
James Bardin 2017-03-01 11:48:38 -05:00
parent f9aa3d3a0b
commit 1e80c402bf
1 changed files with 25 additions and 0 deletions

View File

@ -876,6 +876,31 @@ func TestInterpolator_sets(t *testing.T) {
interfaceToVariableSwallowError(set)) interfaceToVariableSwallowError(set))
} }
// When a splat reference is made to a resource that is unknown, we should
// return an error.
func TestInterpolater_resourceUnknownVariableList(t *testing.T) {
i := &Interpolater{
Module: testModule(t, "plan-computed-data-resource"),
State: NewState(), // state,
StateLock: new(sync.RWMutex),
}
scope := &InterpolationScope{
Path: rootModulePath,
}
// missing "data" from the reference here
v, err := config.NewInterpolatedVariable("aws_vpc.bar.*.foo")
if err != nil {
t.Fatalf("err: %s", err)
}
_, err = i.Values(scope, map[string]config.InterpolatedVariable{"foo": v})
if err == nil {
t.Fatal("expected error interpolating invalid resource")
}
}
func testInterpolate( func testInterpolate(
t *testing.T, i *Interpolater, t *testing.T, i *Interpolater,
scope *InterpolationScope, scope *InterpolationScope,