From 5ed7f2a798a47799b7a84ff2e98fb53b3652a195 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 14 Mar 2023 10:04:28 -0400 Subject: [PATCH 1/2] always use the RenderHuman constructor --- internal/command/jsonformat/renderer.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/internal/command/jsonformat/renderer.go b/internal/command/jsonformat/renderer.go index 6dd0d13e9c..e176603391 100644 --- a/internal/command/jsonformat/renderer.go +++ b/internal/command/jsonformat/renderer.go @@ -81,10 +81,9 @@ func (renderer Renderer) RenderHumanState(state State) { return } - opts := computed.RenderHumanOpts{ - ShowUnchangedChildren: true, - HideDiffActionSymbols: true, - } + opts := computed.NewRenderHumanOpts(renderer.Colorize) + opts.ShowUnchangedChildren = true + opts.HideDiffActionSymbols = true state.renderHumanStateModule(renderer, state.RootModule, opts, true) state.renderHumanStateOutputs(renderer, opts) @@ -119,11 +118,11 @@ func (r Renderer) RenderLog(log *JSONLog) error { return err } + opts := computed.NewRenderHumanOpts(r.Colorize) + opts.ShowUnchangedChildren = true + outputDiff := change.ComputeDiffForType(ctype) - outputStr := outputDiff.RenderHuman(0, computed.RenderHumanOpts{ - Colorize: r.Colorize, - ShowUnchangedChildren: true, - }) + outputStr := outputDiff.RenderHuman(0, opts) msg := fmt.Sprintf("%s = %s", name, outputStr) r.Streams.Println(msg) From 06f1ceb0265a523f61e4e86e99cad0c07243b77c Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 14 Mar 2023 10:04:37 -0400 Subject: [PATCH 2/2] add some output values to the show state test --- internal/command/show_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/command/show_test.go b/internal/command/show_test.go index 4f2c9e88e9..169b75dc1b 100644 --- a/internal/command/show_test.go +++ b/internal/command/show_test.go @@ -447,6 +447,13 @@ func TestShow_plan_json(t *testing.T) { func TestShow_state(t *testing.T) { originalState := testState() + root := originalState.RootModule() + root.SetOutputValue("test", cty.ObjectVal(map[string]cty.Value{ + "attr": cty.NullVal(cty.DynamicPseudoType), + "null": cty.NullVal(cty.String), + "list": cty.ListVal([]cty.Value{cty.NullVal(cty.Number)}), + }), false) + statePath := testStateFile(t, originalState) defer os.RemoveAll(filepath.Dir(statePath))