Merge pull request #6958 from hashicorp/fix-terraform-show
core: Update `terraform show` to deal with lists
This commit is contained in:
commit
0075bd75fd
|
@ -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")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue