-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ephemeral: render write-only attributes in plan UI
- Loading branch information
1 parent
572d12b
commit 11ae302
Showing
6 changed files
with
269 additions
and
39 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
internal/command/jsonformat/computed/renderers/write_only.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// 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{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.