core: Update `terraform show` to deal with lists

Fixes #6931.
This commit is contained in:
James Nugent 2016-05-31 17:13:04 -05:00
parent 4820512196
commit c96a8d5302
1 changed files with 11 additions and 1 deletions

View File

@ -61,7 +61,17 @@ func FormatState(opts *FormatStateOpts) string {
// Output each output k/v pair // Output each output k/v pair
for _, k := range ks { for _, k := range ks {
v := m.Outputs[k] v := m.Outputs[k]
buf.WriteString(fmt.Sprintf("%s = %s\n", k, v)) switch output := v.Value.(type) {
case string:
buf.WriteString(fmt.Sprintf("%s = %s", k, output))
buf.WriteString("\n")
case []interface{}:
buf.WriteString(formatListOutput("", k, output))
buf.WriteString("\n")
case map[string]interface{}:
buf.WriteString(formatMapOutput("", k, output))
buf.WriteString("\n")
}
} }
} }