If the whole map is marked, have the same sensitivity behavior as a single value
This commit is contained in:
parent
0520f143a2
commit
1780351636
|
@ -1070,24 +1070,17 @@ func (p *blockBodyDiffPrinter) writeValueDiff(old, new cty.Value, indent int, pa
|
|||
return
|
||||
|
||||
case ty.IsMapType():
|
||||
if old.IsMarked() || new.IsMarked() {
|
||||
p.buf.WriteString("(sensitive)")
|
||||
return
|
||||
}
|
||||
|
||||
p.buf.WriteString("{")
|
||||
if p.pathForcesNewResource(path) {
|
||||
p.buf.WriteString(p.color.Color(forcesNewResourceCaption))
|
||||
}
|
||||
p.buf.WriteString("\n")
|
||||
|
||||
// If the whole map is marked, we need to show our
|
||||
// sensitive block warning rather than attempt to iterate
|
||||
// through a marked map
|
||||
if old.IsMarked() || new.IsMarked() {
|
||||
p.buf.WriteString(strings.Repeat(" ", indent+2))
|
||||
p.buf.WriteString("# This map is (or was) sensitive and will not be displayed")
|
||||
p.buf.WriteString("\n")
|
||||
p.buf.WriteString(strings.Repeat(" ", indent))
|
||||
p.buf.WriteString("}")
|
||||
return
|
||||
}
|
||||
|
||||
var allKeys []string
|
||||
keyLen := 0
|
||||
for it := old.ElementIterator(); it.Next(); {
|
||||
|
|
|
@ -3791,9 +3791,7 @@ func TestResourceChange_sensitiveVariable(t *testing.T) {
|
|||
}
|
||||
# Warning: this attribute value will no longer be marked as sensitive
|
||||
# after applying this change
|
||||
~ map_whole = {
|
||||
# This map is (or was) sensitive and will not be displayed
|
||||
}
|
||||
~ map_whole = (sensitive)
|
||||
# Warning: this attribute value will no longer be marked as sensitive
|
||||
# after applying this change
|
||||
~ some_number = (sensitive)
|
||||
|
@ -3880,9 +3878,7 @@ func TestResourceChange_sensitiveVariable(t *testing.T) {
|
|||
}
|
||||
# Warning: this attribute value will be marked as sensitive and will
|
||||
# not display in UI output after applying this change
|
||||
~ map_whole = {
|
||||
# This map is (or was) sensitive and will not be displayed
|
||||
}
|
||||
~ map_whole = (sensitive)
|
||||
}
|
||||
`,
|
||||
},
|
||||
|
@ -3981,9 +3977,7 @@ func TestResourceChange_sensitiveVariable(t *testing.T) {
|
|||
~ "dinner" = (sensitive)
|
||||
# (1 unchanged element hidden)
|
||||
}
|
||||
~ map_whole = {
|
||||
# This map is (or was) sensitive and will not be displayed
|
||||
}
|
||||
~ map_whole = (sensitive)
|
||||
}
|
||||
`,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue