mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-27 00:46:25 -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
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -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))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user