diff --git a/config/variable_test.go b/config/variable_test.go index c8b763405..a7f11e9f8 100644 --- a/config/variable_test.go +++ b/config/variable_test.go @@ -32,6 +32,22 @@ func TestVariableDetectWalker(t *testing.T) { } } +func TestVariableDetectWalker_resource(t *testing.T) { + w := new(variableDetectWalker) + + str := `foo ${ec2.foo.bar}` + if err := w.Primitive(reflect.ValueOf(str)); err != nil { + t.Fatalf("err: %s", err) + } + + if len(w.Variables) != 1 { + t.Fatalf("bad: %#v", w.Variables) + } + if w.Variables["ec2.foo.bar"].(*ResourceVariable).FullKey() != "ec2.foo.bar" { + t.Fatalf("bad: %#v", w.Variables) + } +} + func TestVariableDetectWalker_bad(t *testing.T) { w := new(variableDetectWalker)