export ShimLegacyState to use it in resource tests

The helper/resource test harness needs to shim the legacy states as
well. Export this so we can get an error to check too.
This commit is contained in:
James Bardin 2018-12-04 15:38:34 -05:00
parent 7cec01a883
commit a65624e0c1
1 changed files with 3 additions and 3 deletions

View File

@ -901,14 +901,14 @@ func parseVariableAsHCL(name string, input string, targetType config.VariableTyp
}
}
// shimLegacyState is a helper that takes the legacy state type and
// ShimLegacyState is a helper that takes the legacy state type and
// converts it to the new state type.
//
// This is implemented as a state file upgrade, so it will not preserve
// parts of the state structure that are not included in a serialized state,
// such as the resolved results of any local values, outputs in non-root
// modules, etc.
func shimLegacyState(legacy *State) (*states.State, error) {
func ShimLegacyState(legacy *State) (*states.State, error) {
if legacy == nil {
return nil, nil
}
@ -928,7 +928,7 @@ func shimLegacyState(legacy *State) (*states.State, error) {
// the conversion does not succeed. This is primarily intended for tests where
// the given legacy state is an object constructed within the test.
func MustShimLegacyState(legacy *State) *states.State {
ret, err := shimLegacyState(legacy)
ret, err := ShimLegacyState(legacy)
if err != nil {
panic(err)
}