mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-02-28 05:00:55 -05:00
* change -> diff, value -> change * also update readme# * Update internal/command/jsonformat/computed/diff.go Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com> * add interface assertions for diff renderers Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>
34 lines
773 B
Go
34 lines
773 B
Go
package renderers
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/terraform/internal/command/jsonformat/computed"
|
|
|
|
"github.com/hashicorp/terraform/internal/plans"
|
|
)
|
|
|
|
var _ computed.DiffRenderer = (*unknownRenderer)(nil)
|
|
|
|
func Unknown(before computed.Diff) computed.DiffRenderer {
|
|
return &unknownRenderer{
|
|
before: before,
|
|
}
|
|
}
|
|
|
|
type unknownRenderer struct {
|
|
NoWarningsRenderer
|
|
|
|
before computed.Diff
|
|
}
|
|
|
|
func (renderer unknownRenderer) RenderHuman(diff computed.Diff, indent int, opts computed.RenderHumanOpts) string {
|
|
if diff.Action == plans.Create {
|
|
return "(known after apply)"
|
|
}
|
|
|
|
// Never render null suffix for children of unknown changes.
|
|
opts.OverrideNullSuffix = true
|
|
return fmt.Sprintf("%s -> (known after apply)", renderer.before.RenderHuman(indent, opts))
|
|
}
|