func TestResourceConfigEqual_computedKeyOrder(t *testing.T) { c := map[string]interface{}{"foo": "${a.b.c}"} rc := NewResourceConfig(config.TestRawConfig(t, c)) rc2 := NewResourceConfig(config.TestRawConfig(t, c)) // Set the computed keys manual rc.ComputedKeys = []string{"foo", "bar"} rc2.ComputedKeys = []string{"bar", "foo"} if !rc.Equal(rc2) { t.Fatal("should be equal") } }
func TestNodeApplyableModuleVariableReference_grandchild(t *testing.T) { n := &NodeApplyableModuleVariable{ PathValue: []string{"root", "child", "grandchild"}, Config: &config.Variable{Name: "foo"}, Value: config.TestRawConfig(t, map[string]interface{}{ "foo": `${var.foo}`, }), } expected := []string{"module.child.var.foo"} actual := n.References() if !reflect.DeepEqual(actual, expected) { t.Fatalf("%#v != %#v", actual, expected) } }