Merge pull request #7084 from hashicorp/packer_inspect_sensitive
make packer inspect not print sensitive variables.
This commit is contained in:
commit
ecc20cf816
|
@ -50,6 +50,11 @@ func (c *InspectCommand) Run(args []string) int {
|
|||
} else {
|
||||
requiredHeader := false
|
||||
for k, v := range tpl.Variables {
|
||||
for _, sensitive := range tpl.SensitiveVariables {
|
||||
if ok := strings.Compare(sensitive.Default, v.Default); ok == 0 {
|
||||
v.Default = "<sensitive>"
|
||||
}
|
||||
}
|
||||
if v.Required {
|
||||
if !requiredHeader {
|
||||
requiredHeader = true
|
||||
|
@ -82,6 +87,11 @@ func (c *InspectCommand) Run(args []string) int {
|
|||
if v.Required {
|
||||
continue
|
||||
}
|
||||
for _, sensitive := range tpl.SensitiveVariables {
|
||||
if ok := strings.Compare(sensitive.Default, v.Default); ok == 0 {
|
||||
v.Default = "<sensitive>"
|
||||
}
|
||||
}
|
||||
|
||||
padding := strings.Repeat(" ", max-len(k))
|
||||
output := fmt.Sprintf(" %s%s = %s", k, padding, v.Default)
|
||||
|
|
Loading…
Reference in New Issue