Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New option: -mask-sensitive to allow masking sensitive attributes #8

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Usage: tfadd [global options] state [options]
Options:

-full Output all non-computed properties in the generated config
-mask-sensitive Mask sensitive properties
-target=addr Only generate for the specified resource (can specify multiple times)
`
return strings.TrimSpace(helpText)
Expand All @@ -82,6 +83,7 @@ Options:
func (r *stateCommand) Run(args []string) int {
fset := defaultFlagSet("state")
flagFull := fset.Bool("full", false, "Whether to generate all non-computed properties")
flagMaskSensitive := fset.Bool("mask-sensitive", false, "Whether to mask sensitive properties")
var flagTargets arrayFlag
fset.Var(&flagTargets, "target", "Only generate for the specified resource")
if err := fset.Parse(args); err != nil {
Expand All @@ -103,7 +105,10 @@ func (r *stateCommand) Run(args []string) int {
fmt.Fprintf(os.Stderr, err.Error())
return 1
}
opts := []tfadd.StateOption{tfadd.Full(*flagFull)}
opts := []tfadd.OptionSetter{
tfadd.Full(*flagFull),
tfadd.MaskSenstitive(*flagMaskSensitive),
}

var template []byte
if len(flagTargets) == 0 {
Expand Down
7 changes: 7 additions & 0 deletions tfadd/internal/option.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package internal

type Option struct {
// Whether to mask the sensitive attributes in the generated config?
// Set via MaskSensitive option.
MaskSensitive bool
}
Loading
Loading