Merge pull request #12936 from hashicorp/b-state-v1

terraform: V1 to V2 upgrade should treat nil path as root path
pull/12937/head
Mitchell Hashimoto 9 years ago committed by GitHub
commit fe0733b560

@ -68,6 +68,11 @@ func (old *moduleStateV1) upgradeToV2() (*ModuleState, error) {
if err != nil {
return nil, fmt.Errorf("Error upgrading ModuleState V1: %v", err)
}
if path == nil {
// We found some V1 states with a nil path. Assume root and catch
// duplicate path errors later (as part of Validate).
path = rootModulePath
}
// Outputs needs upgrading to use the new structure
outputs := make(map[string]*OutputState)

@ -18,7 +18,7 @@ func upgradeStateV2ToV3(old *State) (*State, error) {
// Ensure the copied version is v2 before attempting to upgrade
if new.Version != 2 {
return nil, fmt.Errorf("Cannot appply v2->v3 state upgrade to " +
return nil, fmt.Errorf("Cannot apply v2->v3 state upgrade to " +
"a state which is not version 2.")
}

Loading…
Cancel
Save