core: Use OutputState in JSON instead of map

This commit forward ports the changes made for 0.6.17, in order to store
the type and sensitive flag against outputs.

It also refactors the logic of the import for V0 to V1 state, and
fixes up the call sites of the new format for outputs in V2 state.

Finally we fix up tests which did not previously set a state version
where one is required.
This commit is contained in:
James Nugent 2016-05-11 20:05:02 -04:00
parent 861dfc0e00
commit 2fd77895b3
1 changed files with 5 additions and 1 deletions

View File

@ -54,7 +54,11 @@ func dataSourceRemoteStateRead(d *schema.ResourceData, meta interface{}) error {
var outputs map[string]interface{}
if !state.State().Empty() {
outputs = state.State().RootModule().Outputs
outputValueMap := make(map[string]string)
for key, output := range state.State().RootModule().Outputs {
//This is ok for 0.6.17 as outputs will have been strings
outputValueMap[key] = output.Value.(string)
}
}
d.SetId(time.Now().UTC().String())