command/format: show planned changes in rendered plan
This codepath is going to be significantly changed before release to make it support structural diff of the new data types, but this lets us lean on the old renderer to produce partial output in the mean time while we continue to work on getting things working end-to-end after the considerable refactoring that's been going on.
This commit is contained in:
parent
bd299b9a22
commit
5731703de5
|
@ -3,6 +3,7 @@ package format
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -63,6 +64,7 @@ type PlanStats struct {
|
||||||
|
|
||||||
// NewPlan produces a display-oriented Plan from a terraform.Plan.
|
// NewPlan produces a display-oriented Plan from a terraform.Plan.
|
||||||
func NewPlan(changes *plans.Changes) *Plan {
|
func NewPlan(changes *plans.Changes) *Plan {
|
||||||
|
log.Printf("[TRACE] NewPlan for %#v", changes)
|
||||||
ret := &Plan{}
|
ret := &Plan{}
|
||||||
if changes == nil {
|
if changes == nil {
|
||||||
// Nothing to do!
|
// Nothing to do!
|
||||||
|
@ -71,6 +73,7 @@ func NewPlan(changes *plans.Changes) *Plan {
|
||||||
|
|
||||||
for _, rc := range changes.Resources {
|
for _, rc := range changes.Resources {
|
||||||
addr := rc.Addr
|
addr := rc.Addr
|
||||||
|
log.Printf("[TRACE] NewPlan found %s", addr)
|
||||||
dataSource := addr.Resource.Resource.Mode == addrs.DataResourceMode
|
dataSource := addr.Resource.Resource.Mode == addrs.DataResourceMode
|
||||||
|
|
||||||
// We create "delete" actions for data resources so we can clean
|
// We create "delete" actions for data resources so we can clean
|
||||||
|
@ -119,6 +122,8 @@ func NewPlan(changes *plans.Changes) *Plan {
|
||||||
// don't include any attributes here.
|
// don't include any attributes here.
|
||||||
// FIXME: Implement the structural diff renderer to replace this
|
// FIXME: Implement the structural diff renderer to replace this
|
||||||
// codepath altogether.
|
// codepath altogether.
|
||||||
|
|
||||||
|
ret.Resources = append(ret.Resources, did)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the instance diffs by their addresses for display.
|
// Sort the instance diffs by their addresses for display.
|
||||||
|
|
Loading…
Reference in New Issue