contexts have a copy of the state

We need to build a new context go get at the modified state
This commit is contained in:
James Bardin 2020-09-11 11:12:16 -04:00
parent a3c9d7abc1
commit d19f440d81
1 changed files with 10 additions and 5 deletions

View File

@ -9155,11 +9155,16 @@ func TestContext2Apply_destroyWithProviders(t *testing.T) {
}
// correct the state
state.Modules["module.mod.module.removed"].Resources["aws_instance.child"].ProviderConfig = addrs.AbsProviderConfig{
Provider: addrs.NewDefaultProvider("aws"),
Alias: "bar",
Module: addrs.RootModule,
}
state.Modules["module.mod.module.removed"].Resources["aws_instance.child"].ProviderConfig = mustProviderConfig(`provider["registry.terraform.io/hashicorp/aws"].bar`)
ctx = testContext2(t, &ContextOpts{
Config: m,
Providers: map[addrs.Provider]providers.Factory{
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
},
State: state,
Destroy: true,
})
if _, diags := ctx.Plan(); diags.HasErrors() {
t.Fatal(diags.Err())