terraform: Precondition and postcondition blocks generate dependencies
If a resource or output value has a precondition or postcondition rule then anything the condition depends on is a dependency of the object, because the condition rules will be evaluated as part of visiting the relevant graph node.
This commit is contained in:
parent
9076400436
commit
c827c049fe
|
@ -237,8 +237,11 @@ func referencesForOutput(c *configs.Output) []*addrs.Reference {
|
|||
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...)
|
||||
}
|
||||
return refs
|
||||
|
||||
}
|
||||
|
||||
// GraphNodeReferencer
|
||||
|
|
|
@ -172,6 +172,16 @@ func (n *NodeAbstractResource) References() []*addrs.Reference {
|
|||
result = append(result, refs...)
|
||||
}
|
||||
}
|
||||
|
||||
for _, check := range c.Preconditions {
|
||||
refs, _ := lang.ReferencesInExpr(check.Condition)
|
||||
result = append(result, refs...)
|
||||
}
|
||||
for _, check := range c.Postconditions {
|
||||
refs, _ := lang.ReferencesInExpr(check.Condition)
|
||||
result = append(result, refs...)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue