opentofu/internal/command/jsonformat/differ/sensitive.go
Liam Cervante b8b1a8d430
Add support for unknown/computed values in the structured renderer (#32378)
* prep for processing the structured run output

* undo unwanted change to a json key

* Add skeleton functions and API for refactored renderer

* goimports

* Fix documentation of the RenderOpts struct

* Add rendering functionality for primitives to the structured renderer

* add test case for override

* Add support for parsing and rendering sensitive values in the renderer

* Add support for unknown/computed values in the structured renderer

* delete missing unit tests
2023-01-09 11:55:55 +01:00

29 lines
673 B
Go

package differ
import "github.com/hashicorp/terraform/internal/command/jsonformat/change"
func (v Value) checkForSensitive() (change.Change, bool) {
beforeSensitive := v.isBeforeSensitive()
afterSensitive := v.isAfterSensitive()
if !beforeSensitive && !afterSensitive {
return change.Change{}, false
}
return v.AsChange(change.Sensitive(v.Before, v.After, beforeSensitive, afterSensitive)), true
}
func (v Value) isBeforeSensitive() bool {
if sensitive, ok := v.BeforeSensitive.(bool); ok {
return sensitive
}
return false
}
func (v Value) isAfterSensitive() bool {
if sensitive, ok := v.AfterSensitive.(bool); ok {
return sensitive
}
return false
}