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) 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))