failing test with wrong interpolated list order

The plan diffs for aws_instance.a and aws_instance.b should be
identical.
This commit is contained in:
James Bardin 2016-12-15 13:22:53 -05:00
parent d026745823
commit 61982be9c6
2 changed files with 34 additions and 0 deletions

View File

@ -2921,3 +2921,30 @@ func TestContext2Plan_createBeforeDestroy_depends_datasource(t *testing.T) {
t.Fatalf("missing diff for data.aws_vpc.bar.1")
}
}
// interpolated lists need to be stored in the original order.
func TestContext2Plan_listOrder(t *testing.T) {
m := testModule(t, "plan-list-order")
p := testProvider("aws")
p.ApplyFn = testApplyFn
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Module: m,
Providers: map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p),
},
})
plan, err := ctx.Plan()
if err != nil {
t.Fatalf("err: %s", err)
}
rDiffs := plan.Diff.Modules[0].Resources
rDiffA := rDiffs["aws_instance.a"]
rDiffB := rDiffs["aws_instance.b"]
if !rDiffA.Equal(rDiffB) {
t.Fatal("aws_instance.a and aws_instance.b diffs should match:\n", plan)
}
}

View File

@ -0,0 +1,7 @@
resource "aws_instance" "a" {
foo = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20]
}
resource "aws_instance" "b" {
foo = "${aws_instance.a.foo}"
}