state: Add support for outputs of multiple types
This commit adds the groundwork for supporting module outputs of types other than string. In order to do so, the state version is increased from 1 to 2 (though the "public-facing" state version is actually as the first state file was binary). Tests are added to ensure that V2 (1) state is upgraded to V3 (2) state, though no separate read path is required since the V2 JSON will unmarshal correctly into the V3 structure. Outputs in a ModuleState are now of type map[string]interface{}, and a test covers round-tripping string, []string and map[string]string, which should cover all of the types in question. Type switches have been added where necessary to deal with the interface{} value, but they currently default to panicking when the input is not a string.
This commit is contained in:
parent
e8d19637d3
commit
433fcb3046
|
@ -60,7 +60,7 @@ func resourceRemoteStateRead(d *schema.ResourceData, meta interface{}) error {
|
|||
return err
|
||||
}
|
||||
|
||||
var outputs map[string]string
|
||||
var outputs map[string]interface{}
|
||||
if !state.State().Empty() {
|
||||
outputs = state.State().RootModule().Outputs
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue