2014-06-05 08:57:06 -05:00
|
|
|
package terraform
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"fmt"
|
|
|
|
"sort"
|
|
|
|
)
|
|
|
|
|
|
|
|
func testDiffStr(d *Diff) string {
|
|
|
|
var buf bytes.Buffer
|
|
|
|
|
|
|
|
names := make([]string, len(d.Resources))
|
|
|
|
for n, _ := range d.Resources {
|
|
|
|
names = append(names, n)
|
|
|
|
}
|
|
|
|
sort.Strings(names)
|
|
|
|
|
|
|
|
for _, n := range names {
|
|
|
|
r := d.Resources[n]
|
|
|
|
buf.WriteString(fmt.Sprintf("%s\n", n))
|
|
|
|
for attr, attrDiff := range r {
|
2014-06-05 22:17:03 -05:00
|
|
|
v := attrDiff.New
|
|
|
|
if attrDiff.NewComputed {
|
|
|
|
v = "<computed>"
|
|
|
|
}
|
|
|
|
|
2014-06-05 08:57:06 -05:00
|
|
|
buf.WriteString(fmt.Sprintf(
|
|
|
|
" %s: %#v => %#v\n",
|
|
|
|
attr,
|
|
|
|
attrDiff.Old,
|
2014-06-05 22:17:03 -05:00
|
|
|
v,
|
2014-06-05 08:57:06 -05:00
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return buf.String()
|
|
|
|
}
|