mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
output refs missing error_message
Output references must also include the error_message expression. Fix the early return in referencesForOutput, which could skip preconditions. The small slice allocation optimization is not really needed here, since this is not a hot path at all.
This commit is contained in:
parent
6e2a7496c4
commit
1790f844b3
@ -278,19 +278,21 @@ func (n *NodeApplyableOutput) ReferenceableAddrs() []addrs.Referenceable {
|
||||
}
|
||||
|
||||
func referencesForOutput(c *configs.Output) []*addrs.Reference {
|
||||
var refs []*addrs.Reference
|
||||
|
||||
impRefs, _ := lang.ReferencesInExpr(c.Expr)
|
||||
expRefs, _ := lang.References(c.DependsOn)
|
||||
l := len(impRefs) + len(expRefs)
|
||||
if l == 0 {
|
||||
return nil
|
||||
}
|
||||
refs := make([]*addrs.Reference, 0, l)
|
||||
|
||||
refs = append(refs, impRefs...)
|
||||
refs = append(refs, expRefs...)
|
||||
|
||||
for _, check := range c.Preconditions {
|
||||
checkRefs, _ := lang.ReferencesInExpr(check.Condition)
|
||||
refs = append(refs, checkRefs...)
|
||||
condRefs, _ := lang.ReferencesInExpr(check.Condition)
|
||||
refs = append(refs, condRefs...)
|
||||
errRefs, _ := lang.ReferencesInExpr(check.ErrorMessage)
|
||||
refs = append(refs, errRefs...)
|
||||
}
|
||||
|
||||
return refs
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user