Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dineshba/tf-summarize
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.12
Choose a base ref
...
head repository: dineshba/tf-summarize
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.3.13
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Oct 24, 2024

  1. Print raw diff when there is error during jsonDiff for -json flag (#81)

    dineshba authored Oct 24, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    Copy the full SHA
    eac0f29 View commit details
Showing with 6 additions and 1 deletion.
  1. +6 −1 writer/json.go
7 changes: 6 additions & 1 deletion writer/json.go
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"io"
"os"

"github.com/dineshba/tf-summarize/terraformstate"
"github.com/dineshba/tf-summarize/tree"
@@ -40,7 +41,11 @@ func treeValue(t tree.Tree) interface{} {
after, _ := json.Marshal(t.Value.Change.After)
_, str := jsondiff.Compare(before, after, &opts)
diff = make(map[string]interface{})
_ = json.Unmarshal([]byte(str), &diff)
err := json.Unmarshal([]byte(str), &diff)
if err != nil {
fmt.Fprintf(os.Stderr, "warning: unmarshalling diff error: %s\n", err)
diff = fmt.Sprintf("raw diff: %s", str)
}
} else {
if t.IsAddition() || t.IsImport() {
diff = t.Value.Change.After