If the path is empty, we should not be marking the path

This commit is contained in:
Pam Selle 2020-08-31 17:08:10 -04:00
parent 84d118e18f
commit 896d277a69
2 changed files with 18 additions and 14 deletions

View File

@ -127,6 +127,7 @@ func ResourceChange(
// Now that the change is decoded, add back the marks at the defined paths
// change.Markinfo
if len(change.ValMarks.Path) != 0 {
changeV.Change.After, _ = cty.Transform(changeV.Change.After, func(p cty.Path, v cty.Value) (cty.Value, error) {
if p.Equals(change.ValMarks.Path) {
// TODO The mark is at change.Markinfo.Marks and it would be proper
@ -135,6 +136,7 @@ func ResourceChange(
}
return v, nil
})
}
bodyWritten := p.writeBlockBodyDiff(schema, changeV.Before, changeV.After, 6, path)
if bodyWritten {

View File

@ -256,12 +256,14 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
plannedNewVal := resp.PlannedState
// Add the mark back to the planned new value
if len(markedPath) != 0 {
plannedNewVal, _ = cty.Transform(plannedNewVal, func(p cty.Path, v cty.Value) (cty.Value, error) {
if p.Equals(markedPath) {
return v.Mark("sensitive"), nil
}
return v, nil
})
}
plannedPrivate := resp.PlannedPrivate