diff --git a/terraform/state.go b/terraform/state.go
index <HASH>..<HASH> 100644
--- a/terraform/state.go
+++ b/terraform/state.go
@@ -175,7 +175,13 @@ func (s *State) addModule(path addrs.ModuleInstance) *ModuleState {
 	// This requires that none of the steps have instance keys, which is
 	// true for all addresses at the time of implementing this because
 	// "count" and "for_each" are not yet implemented for modules.
-	legacyPath := make([]string, len(path))
+	// For the purposes of state, the legacy address format also includes
+	// a redundant extra prefix element "root". It is important to include
+	// this because the "prune" method will remove any module that has a
+	// path length less than one, and other parts of the state code will
+	// trim off the first element indiscriminately.
+	legacyPath := make([]string, len(path)+1)
+	legacyPath[0] = "root"
 	for i, step := range path {
 		if step.InstanceKey != addrs.NoKey {
 			// FIXME: Once the rest of Terraform is ready to use count and
@@ -184,7 +190,7 @@ func (s *State) addModule(path addrs.ModuleInstance) *ModuleState {
 			panic("state cannot represent modules with count or for_each keys")
 		}
 
-		legacyPath[i] = step.Name
+		legacyPath[i+1] = step.Name
 	}
 
 	m = &ModuleState{Path: legacyPath}
core: include "root" element when constructing legacy ModuleState path

We've not yet adjusted any of the state structs to reflect our new address
types because they are used with encoding/json to produce our state file
format, but the shimming here previously was incorrect because it failed
to include the special "root" string that's always required at element
zero of a module path in the state.