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.
This commit is contained in:
James Bardin 2021-10-12 13:47:47 -04:00
parent ef8f1b3e38
commit 656f03b250
1 changed files with 2 additions and 2 deletions

View File

@ -1543,8 +1543,8 @@ func TestContext2Apply_destroyModuleVarProviderConfig(t *testing.T) {
p := testProvider("aws") p := testProvider("aws")
p.PlanResourceChangeFn = testDiffFn p.PlanResourceChangeFn = testDiffFn
state := states.NewState() state := states.NewState()
root := state.EnsureModule(addrs.RootModuleInstance) child := state.EnsureModule(addrs.RootModuleInstance.Child("child", addrs.NoKey))
root.SetResourceInstanceCurrent( child.SetResourceInstanceCurrent(
mustResourceInstanceAddr("aws_instance.foo").Resource, mustResourceInstanceAddr("aws_instance.foo").Resource,
&states.ResourceInstanceObjectSrc{ &states.ResourceInstanceObjectSrc{
Status: states.ObjectReady, Status: states.ObjectReady,