Merge pull request #6958 from hashicorp/fix-terraform-show

core: Update `terraform show` to deal with lists
This commit is contained in:
James Nugent 2016-06-01 10:06:19 -05:00
commit 0075bd75fd
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
for _, k := range ks {
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")
}
}
}