minor fixes

This commit is contained in:
James Bardin 2022-04-20 12:51:24 -04:00
parent 3a0a019521
commit 1e79682c24
2 changed files with 5 additions and 8 deletions

View File

@ -586,14 +586,14 @@ func decodeReplaceTriggeredBy(expr hcl.Expression) ([]hcl.Expression, hcl.Diagno
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Invalid replace_triggered_by expression",
Detail: "Missing resource reference in replace_triggered_by_expression.",
Detail: "Missing resource reference in replace_triggered_by expression.",
Subject: expr.Range().Ptr(),
})
case resourceCount > 1:
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Invalid replace_triggered_by expression",
Detail: "Multiple resource references in replace_triggered_by_expression.",
Detail: "Multiple resource references in replace_triggered_by expression.",
Subject: expr.Range().Ptr(),
})
}

View File

@ -345,13 +345,10 @@ func (n *NodePlannableResourceInstance) replaceTriggered(ctx EvalContext, repDat
if replace {
// FIXME: forceReplace accomplishes the same goal, however we may
// want to communicate more information about which resource
// Rather than further complicating the plan method with more
// options, we can refactor both of these featured later.
n.forceReplace = append(n.forceReplace, n.Addr)
//
// triggered the replacement in the plan.
// EvalauteReplaceTriggeredBy returns a reference to store
// somewhere for this purpose too.
// Rather than further complicating the plan method with more
// options, we can refactor both of these features later.
n.forceReplace = append(n.forceReplace, n.Addr)
log.Printf("[DEBUG] ReplaceTriggeredBy forcing replacement of %s due to change in %s", n.Addr, ref.DisplayString())
n.replaceTriggeredBy = append(n.replaceTriggeredBy, ref)