From 656f03b250a8ce532c9ab6c7d9f75f6746b090d9 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 12 Oct 2021 13:47:47 -0400 Subject: [PATCH] fix test fixture had the instance in the wrong mod Make the state match the fixture config. The old test was not technically invalid, but because it caused multiple instances of the provider to be created, they were backed by the same MockProvider value resulting in the `*Called` fields interfering. --- internal/terraform/context_apply_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/terraform/context_apply_test.go b/internal/terraform/context_apply_test.go index a525ab52d..8bacd2d91 100644 --- a/internal/terraform/context_apply_test.go +++ b/internal/terraform/context_apply_test.go @@ -1543,8 +1543,8 @@ func TestContext2Apply_destroyModuleVarProviderConfig(t *testing.T) { p := testProvider("aws") p.PlanResourceChangeFn = testDiffFn state := states.NewState() - root := state.EnsureModule(addrs.RootModuleInstance) - root.SetResourceInstanceCurrent( + child := state.EnsureModule(addrs.RootModuleInstance.Child("child", addrs.NoKey)) + child.SetResourceInstanceCurrent( mustResourceInstanceAddr("aws_instance.foo").Resource, &states.ResourceInstanceObjectSrc{ Status: states.ObjectReady,