mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-28 09:26:26 -06:00
Merge pull request #32840 from hashicorp/jbardin/render-output-crash
Prevent nil Colorize options when rendering state outputs
This commit is contained in:
commit
ccb376a189
@ -81,10 +81,9 @@ func (renderer Renderer) RenderHumanState(state State) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := computed.RenderHumanOpts{
|
opts := computed.NewRenderHumanOpts(renderer.Colorize)
|
||||||
ShowUnchangedChildren: true,
|
opts.ShowUnchangedChildren = true
|
||||||
HideDiffActionSymbols: true,
|
opts.HideDiffActionSymbols = true
|
||||||
}
|
|
||||||
|
|
||||||
state.renderHumanStateModule(renderer, state.RootModule, opts, true)
|
state.renderHumanStateModule(renderer, state.RootModule, opts, true)
|
||||||
state.renderHumanStateOutputs(renderer, opts)
|
state.renderHumanStateOutputs(renderer, opts)
|
||||||
@ -119,11 +118,11 @@ func (r Renderer) RenderLog(log *JSONLog) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts := computed.NewRenderHumanOpts(r.Colorize)
|
||||||
|
opts.ShowUnchangedChildren = true
|
||||||
|
|
||||||
outputDiff := change.ComputeDiffForType(ctype)
|
outputDiff := change.ComputeDiffForType(ctype)
|
||||||
outputStr := outputDiff.RenderHuman(0, computed.RenderHumanOpts{
|
outputStr := outputDiff.RenderHuman(0, opts)
|
||||||
Colorize: r.Colorize,
|
|
||||||
ShowUnchangedChildren: true,
|
|
||||||
})
|
|
||||||
|
|
||||||
msg := fmt.Sprintf("%s = %s", name, outputStr)
|
msg := fmt.Sprintf("%s = %s", name, outputStr)
|
||||||
r.Streams.Println(msg)
|
r.Streams.Println(msg)
|
||||||
|
@ -447,6 +447,13 @@ func TestShow_plan_json(t *testing.T) {
|
|||||||
|
|
||||||
func TestShow_state(t *testing.T) {
|
func TestShow_state(t *testing.T) {
|
||||||
originalState := testState()
|
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)
|
statePath := testStateFile(t, originalState)
|
||||||
defer os.RemoveAll(filepath.Dir(statePath))
|
defer os.RemoveAll(filepath.Dir(statePath))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user