dineshba/tf-summarize

Panic error after upgrading tf-summarize from 0.3.7 to 0.3.8

dimitridittrich opened this issue · 2 comments

Here at the company we started to have errors in the pipelines after updated our version of tf-summarize from 0.3.7 to 0.3.8
I resolved by returning hardcoded to version 0.3.7.

Error:

panic: interface conversion: interface {} is map[string]interface {}, not []uint8

goroutine *** [running]:
github.com/dineshba/tf-summarize/writer.treeValue({{0xc000***55ab0, 0x4}, 0x0, 0xc0000a70e0, {0x0, 0x0, 0x0}})
	github.com/dineshba/tf-summarize/writer/json.go:39 +0x558
github.com/dineshba/tf-summarize/writer.treeValue({{0xc0000a***0c0, 0x22}, 0x0, 0x0, {0xc000032e20, 0x***, 0x***}})
	github.com/dineshba/tf-summarize/writer/json.go:57 +0x62c
github.com/dineshba/tf-summarize/writer.treeValue({{0xc0000a***080, 0x22}, 0x0, 0x0, {0xc000032e***8, 0x***, 0x***}})
	github.com/dineshba/tf-summarize/writer/json.go:57 +0x62c
github.com/dineshba/tf-summarize/writer.treeValue({{0xc000***55a78, 0x6}, 0x0, 0x0, {0xc000***747f0, 0x2, 0x2}})
	github.com/dineshba/tf-summarize/writer/json.go:57 +0x62c
github.com/dineshba/tf-summarize/writer.JSONWriter.Write({{0xc000***747c0?, 0x2?, 0x4?}}, {0x***b9***8, 0xc000032020})
	github.com/dineshba/tf-summarize/writer/json.go:22 +0xf6
main.main()
	github.com/dineshba/tf-summarize/main.go:7*** +0x8***7

Just to give context, here we use it like this:

steps:
- task: Bash@3
  displayName: 'TF Plan Pretty Print'
  inputs:
    targetType: inline
    script: |
      find . -name plan.json > jsonplans
      COMEBACK=$(pwd)
      while read -r line; do 
          FILE=$(echo $line | sed -r 's/\.\///g' | sed -r 's/plan.json//g')
          cd $FILE
          echo "##[group] Modificações realizadas em: $FILE ========="
          docker run -v $PWD:/workspace -w /workspace ghcr.io/dineshba/tf-summarize plan.json
          docker run -v $PWD:/workspace -w /workspace ghcr.io/dineshba/tf-summarize -json plan.json > changes.json
          echo "##[endgroup]"
          cd $COMEBACK
      done < jsonplans

Seeing the exact same issue

I missed this check during release. Have fixed it and released v0.3.9

Please use this @dimitridittrich @pmcgrath-mck