mirror of
https://github.com/hashicorp/terraform.git
synced 2026-03-22 10:31:22 -04:00
33 lines
936 B
Go
33 lines
936 B
Go
// Copyright IBM Corp. 2014, 2026
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package renderers
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/terraform/internal/command/jsonformat/computed"
|
|
)
|
|
|
|
var _ computed.DiffRenderer = (*writeOnlyRenderer)(nil)
|
|
|
|
func WriteOnly(sensitive bool) computed.DiffRenderer {
|
|
return &writeOnlyRenderer{
|
|
sensitive,
|
|
}
|
|
}
|
|
|
|
type writeOnlyRenderer struct {
|
|
sensitive bool
|
|
}
|
|
|
|
func (renderer writeOnlyRenderer) RenderHuman(diff computed.Diff, indent int, opts computed.RenderHumanOpts) string {
|
|
if renderer.sensitive {
|
|
return fmt.Sprintf("(sensitive, write-only attribute)%s%s", nullSuffix(diff.Action, opts), forcesReplacement(diff.Replace, opts))
|
|
}
|
|
return fmt.Sprintf("(write-only attribute)%s%s", nullSuffix(diff.Action, opts), forcesReplacement(diff.Replace, opts))
|
|
}
|
|
|
|
func (renderer writeOnlyRenderer) WarningsHuman(diff computed.Diff, indent int, opts computed.RenderHumanOpts) []string {
|
|
return []string{}
|
|
}
|