Update object compatible check to unmark

The hack approach appears consistent,
as we can remove marks before calling the
value validation
This commit is contained in:
Pam Selle 2020-09-04 12:59:54 -04:00
parent e9d9205ce8
commit 5b0b1a13a5
1 changed files with 11 additions and 5 deletions

View File

@ -51,11 +51,17 @@ func assertObjectCompatible(schema *configschema.Block, planned, actual cty.Valu
actualV := actual.GetAttr(name)
path := append(path, cty.GetAttrStep{Name: name})
// HACK Unmark the values here so we can get past this testing in Apply
unmarked, _ := plannedV.UnmarkDeep()
unmarkedActual, _ := actualV.UnmarkDeep()
moreErrs := assertValueCompatible(unmarked, unmarkedActual, path)
// If our value is marked, unmark it here before
// checking value assertions
unmarkedActualV := actualV
if actualV.ContainsMarked() {
unmarkedActualV, _ = actualV.UnmarkDeep()
}
unmarkedPlannedV := plannedV
if plannedV.ContainsMarked() {
unmarkedPlannedV, _ = actualV.UnmarkDeep()
}
moreErrs := assertValueCompatible(unmarkedPlannedV, unmarkedActualV, path)
if attrS.Sensitive {
if len(moreErrs) > 0 {
// Use a vague placeholder message instead, to avoid disclosing