mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-13 09:32:24 -06:00
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:
parent
d026745823
commit
61982be9c6
@ -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)
|
||||
}
|
||||
}
|
||||
|
7
terraform/test-fixtures/plan-list-order/main.tf
Normal file
7
terraform/test-fixtures/plan-list-order/main.tf
Normal 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}"
|
||||
}
|
Loading…
Reference in New Issue
Block a user