Hide sensitive outputs in terraform show

This commit is contained in:
Pam Selle 2020-10-28 15:46:09 -04:00
parent e6e0b6ee46
commit f61a342311
2 changed files with 6 additions and 2 deletions

View File

@ -74,7 +74,11 @@ func State(opts *StateOpts) string {
for _, k := range ks {
v := m.OutputValues[k]
p.buf.WriteString(fmt.Sprintf("%s = ", k))
p.writeValue(v.Value, plans.NoOp, 0)
if v.Sensitive {
p.buf.WriteString("(sensitive value)")
} else {
p.writeValue(v.Value, plans.NoOp, 0)
}
p.buf.WriteString("\n")
}
}

View File

@ -219,7 +219,7 @@ map_var = {
"first" = "foo"
"second" = "bar"
}
sensitive_var = "secret!!!"
sensitive_var = (sensitive value)
string_var = "string value"`
func basicState(t *testing.T) *states.State {