diff --git a/command/format_plan.go b/command/format_plan.go index daf3f60aa0c5..84f7d89e755e 100644 --- a/command/format_plan.go +++ b/command/format_plan.go @@ -87,6 +87,7 @@ func formatPlanModuleExpand( // resource header. color := "yellow" symbol := "~" + oldValues := true switch rdiff.ChangeType() { case terraform.DiffDestroyCreate: color = "green" @@ -94,6 +95,7 @@ func formatPlanModuleExpand( case terraform.DiffCreate: color = "green" symbol = "+" + oldValues = false case terraform.DiffDestroy: color = "red" symbol = "-" @@ -134,13 +136,22 @@ func formatPlanModuleExpand( newResource = opts.Color.Color(" [red](forces new resource)") } - buf.WriteString(fmt.Sprintf( - " %s:%s %#v => %#v%s\n", - attrK, - strings.Repeat(" ", keyLen-len(attrK)), - attrDiff.Old, - v, - newResource)) + if oldValues { + buf.WriteString(fmt.Sprintf( + " %s:%s %#v => %#v%s\n", + attrK, + strings.Repeat(" ", keyLen-len(attrK)), + attrDiff.Old, + v, + newResource)) + } else { + buf.WriteString(fmt.Sprintf( + " %s:%s %#v%s\n", + attrK, + strings.Repeat(" ", keyLen-len(attrK)), + v, + newResource)) + } } // Write the reset color so we don't overload the user's terminal