From e13eecbc5bd1c54a36013c27e969b02eeee935cc Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 11 Mar 2020 14:19:52 -0400 Subject: [PATCH] finish provider ModuleInstance replacement --- backend/local/backend_plan_test.go | 10 +++--- backend/testing.go | 2 +- command/apply_destroy_test.go | 8 ++--- command/apply_test.go | 8 ++--- command/command_test.go | 2 +- command/format/diff_test.go | 2 +- command/format/state_test.go | 14 ++++---- command/graph_test.go | 2 +- command/jsonplan/values_test.go | 2 +- command/jsonstate/state_test.go | 22 ++++++------- command/plan_test.go | 4 +-- command/show_test.go | 2 +- command/state_mv_test.go | 52 +++++++++++++++--------------- command/state_rm_test.go | 24 +++++++------- command/state_show.go | 2 +- command/state_show_test.go | 8 ++--- command/taint_test.go | 12 +++---- command/untaint_test.go | 12 +++---- command/workspace_command_test.go | 2 +- helper/resource/state_shim_test.go | 16 ++++----- helper/resource/testing.go | 2 +- plans/plan_test.go | 10 +++--- plans/planfile/tfplan_test.go | 6 ++-- providers/addressed_types_test.go | 10 +++--- repl/session_test.go | 4 +-- states/state_test.go | 8 ++--- states/statemgr/testing.go | 2 +- 27 files changed, 124 insertions(+), 124 deletions(-) diff --git a/backend/local/backend_plan_test.go b/backend/local/backend_plan_test.go index 9aa028653..d6ba5ce08 100644 --- a/backend/local/backend_plan_test.go +++ b/backend/local/backend_plan_test.go @@ -217,7 +217,7 @@ func TestLocal_planDeposedOnly(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) })) @@ -661,7 +661,7 @@ func testPlanState() *states.State { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) return state @@ -688,7 +688,7 @@ func testPlanState_withDataSource() *states.State { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) rootModule.SetResourceInstanceCurrent( @@ -705,7 +705,7 @@ func testPlanState_withDataSource() *states.State { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) return state @@ -732,7 +732,7 @@ func testPlanState_tainted() *states.State { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) return state diff --git a/backend/testing.go b/backend/testing.go index 4521fd753..e6f591e0e 100644 --- a/backend/testing.go +++ b/backend/testing.go @@ -152,7 +152,7 @@ func TestBackendStates(t *testing.T, b Backend) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) diff --git a/command/apply_destroy_test.go b/command/apply_destroy_test.go index bdcfa1a07..784c3029b 100644 --- a/command/apply_destroy_test.go +++ b/command/apply_destroy_test.go @@ -31,7 +31,7 @@ func TestApply_destroy(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -127,7 +127,7 @@ func TestApply_destroyLockedState(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -202,7 +202,7 @@ func TestApply_destroyTargeted(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -218,7 +218,7 @@ func TestApply_destroyTargeted(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) diff --git a/command/apply_test.go b/command/apply_test.go index f411d138d..743f60815 100644 --- a/command/apply_test.go +++ b/command/apply_test.go @@ -835,7 +835,7 @@ func TestApply_refresh(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -992,7 +992,7 @@ func TestApply_state(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -1359,7 +1359,7 @@ func TestApply_backup(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -1663,7 +1663,7 @@ func applyFixturePlanFile(t *testing.T) string { }.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance), ProviderAddr: addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ChangeSrc: plans.ChangeSrc{ Action: plans.Create, diff --git a/command/command_test.go b/command/command_test.go index 1bb715b97..11632df93 100644 --- a/command/command_test.go +++ b/command/command_test.go @@ -273,7 +273,7 @@ func testState() *states.State { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) // DeepCopy is used here to ensure our synthetic state matches exactly diff --git a/command/format/diff_test.go b/command/format/diff_test.go index ef731d5b2..3c6e6460b 100644 --- a/command/format/diff_test.go +++ b/command/format/diff_test.go @@ -3159,7 +3159,7 @@ func runTestCases(t *testing.T, testCases map[string]testCase) { }.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance), ProviderAddr: addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ChangeSrc: plans.ChangeSrc{ Action: tc.Action, diff --git a/command/format/state_test.go b/command/format/state_test.go index 40c97b124..ba7354188 100644 --- a/command/format/state_test.go +++ b/command/format/state_test.go @@ -245,7 +245,7 @@ func basicState(t *testing.T) *states.State { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) rootModule.SetResourceInstanceCurrent( @@ -261,7 +261,7 @@ func basicState(t *testing.T) *states.State { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) return state @@ -297,7 +297,7 @@ func stateWithMoreOutputs(t *testing.T) *states.State { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) return state @@ -324,7 +324,7 @@ func nestedState(t *testing.T) *states.State { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) return state @@ -347,7 +347,7 @@ func deposedState(t *testing.T) *states.State { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) return state @@ -376,7 +376,7 @@ func onlyDeposedState(t *testing.T) *states.State { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) rootModule.SetResourceInstanceDeposed( @@ -393,7 +393,7 @@ func onlyDeposedState(t *testing.T) *states.State { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) return state diff --git a/command/graph_test.go b/command/graph_test.go index a3b4e6a14..bea2d3925 100644 --- a/command/graph_test.go +++ b/command/graph_test.go @@ -127,7 +127,7 @@ func TestGraph_plan(t *testing.T) { }, ProviderAddr: addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, }) emptyConfig, err := plans.NewDynamicValue(cty.EmptyObjectVal, cty.EmptyObject) diff --git a/command/jsonplan/values_test.go b/command/jsonplan/values_test.go index 9fe9043cb..15084e2d9 100644 --- a/command/jsonplan/values_test.go +++ b/command/jsonplan/values_test.go @@ -260,7 +260,7 @@ func TestMarshalPlanResources(t *testing.T) { }.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance), ProviderAddr: addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ChangeSrc: plans.ChangeSrc{ Action: test.Action, diff --git a/command/jsonstate/state_test.go b/command/jsonstate/state_test.go index ef8cb869c..c1b16c8c2 100644 --- a/command/jsonstate/state_test.go +++ b/command/jsonstate/state_test.go @@ -203,7 +203,7 @@ func TestMarshalResources(t *testing.T) { }, ProviderConfig: addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, }, }, @@ -245,7 +245,7 @@ func TestMarshalResources(t *testing.T) { }, ProviderConfig: addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, }, }, @@ -287,7 +287,7 @@ func TestMarshalResources(t *testing.T) { }, ProviderConfig: addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, }, }, @@ -331,7 +331,7 @@ func TestMarshalResources(t *testing.T) { }, ProviderConfig: addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, }, }, @@ -380,7 +380,7 @@ func TestMarshalResources(t *testing.T) { }, ProviderConfig: addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, }, }, @@ -452,7 +452,7 @@ func TestMarshalModules_basic(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -467,7 +467,7 @@ func TestMarshalModules_basic(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: childModule, + Module: childModule.Module(), }, ) s.SetResourceInstanceCurrent( @@ -482,7 +482,7 @@ func TestMarshalModules_basic(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: subModule, + Module: subModule.Module(), }, ) }) @@ -521,7 +521,7 @@ func TestMarshalModules_nested(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -536,7 +536,7 @@ func TestMarshalModules_nested(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: childModule, + Module: childModule.Module(), }, ) s.SetResourceInstanceCurrent( @@ -551,7 +551,7 @@ func TestMarshalModules_nested(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: subModule, + Module: subModule.Module(), }, ) }) diff --git a/command/plan_test.go b/command/plan_test.go index 1891833e7..db0402702 100644 --- a/command/plan_test.go +++ b/command/plan_test.go @@ -126,7 +126,7 @@ func TestPlan_destroy(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -245,7 +245,7 @@ func TestPlan_outPathNoChange(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) diff --git a/command/show_test.go b/command/show_test.go index 3ad7b437d..50e1c32ca 100644 --- a/command/show_test.go +++ b/command/show_test.go @@ -487,7 +487,7 @@ func showFixturePlanFile(t *testing.T, action plans.Action) string { }.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance), ProviderAddr: addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ChangeSrc: plans.ChangeSrc{ Action: action, diff --git a/command/state_mv_test.go b/command/state_mv_test.go index d7968b5e6..95bc6984b 100644 --- a/command/state_mv_test.go +++ b/command/state_mv_test.go @@ -29,7 +29,7 @@ func TestStateMv(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -45,7 +45,7 @@ func TestStateMv(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -160,7 +160,7 @@ func TestStateMv_resourceToInstance(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -176,7 +176,7 @@ func TestStateMv_resourceToInstance(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceMeta( @@ -188,7 +188,7 @@ func TestStateMv_resourceToInstance(t *testing.T) { states.EachList, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -250,7 +250,7 @@ func TestStateMv_instanceToResource(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -265,7 +265,7 @@ func TestStateMv_instanceToResource(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -338,7 +338,7 @@ func TestStateMv_instanceToNewResource(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -409,7 +409,7 @@ func TestStateMv_differentResourceTypes(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -462,7 +462,7 @@ func TestStateMv_explicitWithBackend(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -477,7 +477,7 @@ func TestStateMv_explicitWithBackend(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -537,7 +537,7 @@ func TestStateMv_backupExplicit(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -553,7 +553,7 @@ func TestStateMv_backupExplicit(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -602,7 +602,7 @@ func TestStateMv_stateOutNew(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -656,7 +656,7 @@ func TestStateMv_stateOutExisting(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -675,7 +675,7 @@ func TestStateMv_stateOutExisting(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -755,7 +755,7 @@ func TestStateMv_stateOutNew_count(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -770,7 +770,7 @@ func TestStateMv_stateOutNew_count(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -785,7 +785,7 @@ func TestStateMv_stateOutNew_count(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -843,7 +843,7 @@ func TestStateMv_stateOutNew_largeCount(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) } @@ -859,7 +859,7 @@ func TestStateMv_stateOutNew_largeCount(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -913,7 +913,7 @@ func TestStateMv_stateOutNew_nestedModule(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -928,7 +928,7 @@ func TestStateMv_stateOutNew_nestedModule(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -983,7 +983,7 @@ func TestStateMv_toNewModule(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -1056,7 +1056,7 @@ func TestStateMv_withinBackend(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -1072,7 +1072,7 @@ func TestStateMv_withinBackend(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) diff --git a/command/state_rm_test.go b/command/state_rm_test.go index 02fea0adf..ddb219787 100644 --- a/command/state_rm_test.go +++ b/command/state_rm_test.go @@ -27,7 +27,7 @@ func TestStateRm(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -42,7 +42,7 @@ func TestStateRm(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -92,7 +92,7 @@ func TestStateRmNotChildModule(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) // This second instance has the same local address as the first but @@ -110,7 +110,7 @@ func TestStateRmNotChildModule(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -181,7 +181,7 @@ func TestStateRmNoArgs(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -196,7 +196,7 @@ func TestStateRmNoArgs(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -240,7 +240,7 @@ func TestStateRmNonExist(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -255,7 +255,7 @@ func TestStateRmNonExist(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -300,7 +300,7 @@ func TestStateRm_backupExplicit(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -315,7 +315,7 @@ func TestStateRm_backupExplicit(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -416,7 +416,7 @@ func TestStateRm_backendState(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -431,7 +431,7 @@ func TestStateRm_backendState(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) diff --git a/command/state_show.go b/command/state_show.go index f91f051b6..93544781d 100644 --- a/command/state_show.go +++ b/command/state_show.go @@ -120,7 +120,7 @@ func (c *StateShowCommand) Run(args []string) int { absPc := addrs.AbsProviderConfig{ Provider: rs.ProviderConfig.Provider, Alias: rs.ProviderConfig.Alias, - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, } singleInstance := states.NewState() singleInstance.EnsureModule(addr.Module).SetResourceInstanceCurrent( diff --git a/command/state_show_test.go b/command/state_show_test.go index e382bdf90..b91cca0b8 100644 --- a/command/state_show_test.go +++ b/command/state_show_test.go @@ -27,7 +27,7 @@ func TestStateShow(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -85,7 +85,7 @@ func TestStateShow_multi(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -100,7 +100,7 @@ func TestStateShow_multi(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: submod, + Module: submod.Module(), }, ) }) @@ -206,7 +206,7 @@ func TestStateShow_configured_provider(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test-beta"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) diff --git a/command/taint_test.go b/command/taint_test.go index a34365d4b..80816b837 100644 --- a/command/taint_test.go +++ b/command/taint_test.go @@ -26,7 +26,7 @@ func TestTaint(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -64,7 +64,7 @@ func TestTaint_lockedState(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -253,7 +253,7 @@ func TestTaint_missing(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -289,7 +289,7 @@ func TestTaint_missingAllow(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -368,7 +368,7 @@ func TestTaint_module(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -383,7 +383,7 @@ func TestTaint_module(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) diff --git a/command/untaint_test.go b/command/untaint_test.go index 9584a7654..aa94eebf0 100644 --- a/command/untaint_test.go +++ b/command/untaint_test.go @@ -25,7 +25,7 @@ func TestUntaint(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -68,7 +68,7 @@ func TestUntaint_lockedState(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -279,7 +279,7 @@ func TestUntaint_missing(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -315,7 +315,7 @@ func TestUntaint_missingAllow(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) @@ -403,7 +403,7 @@ func TestUntaint_module(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -418,7 +418,7 @@ func TestUntaint_module(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) diff --git a/command/workspace_command_test.go b/command/workspace_command_test.go index 4d37da610..aefa0e159 100644 --- a/command/workspace_command_test.go +++ b/command/workspace_command_test.go @@ -243,7 +243,7 @@ func TestWorkspace_createWithState(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) diff --git a/helper/resource/state_shim_test.go b/helper/resource/state_shim_test.go index 3894c7392..7363f066e 100644 --- a/helper/resource/state_shim_test.go +++ b/helper/resource/state_shim_test.go @@ -43,7 +43,7 @@ func TestStateShim(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) rootModule.SetResourceInstanceCurrent( @@ -59,7 +59,7 @@ func TestStateShim(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) @@ -78,7 +78,7 @@ func TestStateShim(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: childInstance, + Module: childInstance.Module(), }, ) childModule.SetResourceInstanceCurrent( @@ -102,7 +102,7 @@ func TestStateShim(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: childInstance, + Module: childInstance.Module(), }, ) @@ -128,7 +128,7 @@ func TestStateShim(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: childInstance, + Module: childInstance.Module(), }, ) @@ -145,7 +145,7 @@ func TestStateShim(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: childInstance, + Module: childInstance.Module(), }, ) childModule.SetResourceInstanceCurrent( @@ -161,7 +161,7 @@ func TestStateShim(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: childInstance, + Module: childInstance.Module(), }, ) @@ -178,7 +178,7 @@ func TestStateShim(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: childInstance, + Module: childInstance.Module(), }, ) diff --git a/helper/resource/testing.go b/helper/resource/testing.go index 853241a9e..495e26d15 100644 --- a/helper/resource/testing.go +++ b/helper/resource/testing.go @@ -729,7 +729,7 @@ func testIDOnlyRefresh(c TestCase, opts terraform.ContextOpts, step TestStep, r }, addrs.AbsProviderConfig{ Provider: addrs.NewDefaultProvider("placeholder"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) diff --git a/plans/plan_test.go b/plans/plan_test.go index 03501b619..90cf2ffa5 100644 --- a/plans/plan_test.go +++ b/plans/plan_test.go @@ -21,7 +21,7 @@ func TestProviderAddrs(t *testing.T) { Name: "woot", }.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance), ProviderAddr: addrs.AbsProviderConfig{ - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, Provider: addrs.NewLegacyProvider("test"), }, }, @@ -33,7 +33,7 @@ func TestProviderAddrs(t *testing.T) { }.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance), DeposedKey: "foodface", ProviderAddr: addrs.AbsProviderConfig{ - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, Provider: addrs.NewLegacyProvider("test"), }, }, @@ -44,7 +44,7 @@ func TestProviderAddrs(t *testing.T) { Name: "what", }.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance), ProviderAddr: addrs.AbsProviderConfig{ - Module: addrs.RootModuleInstance.Child("foo", addrs.NoKey), + Module: addrs.RootModule.Child("foo"), Provider: addrs.NewLegacyProvider("test"), }, }, @@ -55,11 +55,11 @@ func TestProviderAddrs(t *testing.T) { got := plan.ProviderAddrs() want := []addrs.AbsProviderConfig{ addrs.AbsProviderConfig{ - Module: addrs.RootModuleInstance.Child("foo", addrs.NoKey), + Module: addrs.RootModule.Child("foo"), Provider: addrs.NewLegacyProvider("test"), }, addrs.AbsProviderConfig{ - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, Provider: addrs.NewLegacyProvider("test"), }, } diff --git a/plans/planfile/tfplan_test.go b/plans/planfile/tfplan_test.go index 3da15289c..ffd6d1c49 100644 --- a/plans/planfile/tfplan_test.go +++ b/plans/planfile/tfplan_test.go @@ -58,7 +58,7 @@ func TestTFPlanRoundTrip(t *testing.T) { }.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance), ProviderAddr: addrs.AbsProviderConfig{ Provider: addrs.NewDefaultProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ChangeSrc: plans.ChangeSrc{ Action: plans.DeleteThenCreate, @@ -79,7 +79,7 @@ func TestTFPlanRoundTrip(t *testing.T) { DeposedKey: "foodface", ProviderAddr: addrs.AbsProviderConfig{ Provider: addrs.NewDefaultProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ChangeSrc: plans.ChangeSrc{ Action: plans.Delete, @@ -198,7 +198,7 @@ func TestTFPlanRoundTripDestroy(t *testing.T) { }.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance), ProviderAddr: addrs.AbsProviderConfig{ Provider: addrs.NewDefaultProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ChangeSrc: plans.ChangeSrc{ Action: plans.Delete, diff --git a/providers/addressed_types_test.go b/providers/addressed_types_test.go index 0bf555bba..5b0e90a43 100644 --- a/providers/addressed_types_test.go +++ b/providers/addressed_types_test.go @@ -11,24 +11,24 @@ import ( func TestAddressedTypesAbs(t *testing.T) { providerAddrs := []addrs.AbsProviderConfig{ addrs.AbsProviderConfig{ - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, Provider: addrs.NewLegacyProvider("aws"), }, addrs.AbsProviderConfig{ - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, Provider: addrs.NewLegacyProvider("aws"), Alias: "foo", }, addrs.AbsProviderConfig{ - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, Provider: addrs.NewLegacyProvider("azure"), }, addrs.AbsProviderConfig{ - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, Provider: addrs.NewLegacyProvider("null"), }, addrs.AbsProviderConfig{ - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, Provider: addrs.NewLegacyProvider("null"), }, } diff --git a/repl/session_test.go b/repl/session_test.go index 4ef4c8b78..3e4b0fda4 100644 --- a/repl/session_test.go +++ b/repl/session_test.go @@ -47,7 +47,7 @@ func TestSession_basicState(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) s.SetResourceInstanceCurrent( @@ -62,7 +62,7 @@ func TestSession_basicState(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewLegacyProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) }) diff --git a/states/state_test.go b/states/state_test.go index ef481a6e6..7feb252a4 100644 --- a/states/state_test.go +++ b/states/state_test.go @@ -37,7 +37,7 @@ func TestState(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewDefaultProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) @@ -81,7 +81,7 @@ func TestState(t *testing.T) { }, ProviderConfig: addrs.AbsProviderConfig{ Provider: addrs.NewDefaultProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, }, }, @@ -144,7 +144,7 @@ func TestStateDeepCopy(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewDefaultProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) rootModule.SetResourceInstanceCurrent( @@ -171,7 +171,7 @@ func TestStateDeepCopy(t *testing.T) { }, addrs.AbsProviderConfig{ Provider: addrs.NewDefaultProvider("test"), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, }, ) diff --git a/states/statemgr/testing.go b/states/statemgr/testing.go index 2ded9ac7a..aab2c393a 100644 --- a/states/statemgr/testing.go +++ b/states/statemgr/testing.go @@ -152,7 +152,7 @@ func TestFullInitialState() *states.State { } providerAddr := addrs.AbsProviderConfig{ Provider: rAddr.DefaultProvider(), - Module: addrs.RootModuleInstance, + Module: addrs.RootModule, } childMod.SetResourceMeta(rAddr, states.EachList, providerAddr) return state