mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-04-07 03:01:48 -04:00
Previously the ReferenceTransformer just had a broad rule that any node which implements GraphNodeDestroyer has its expression references completely ignored. Now that we're starting to allow dynamic expressions for destroy-related settings like "prevent_destroy", we need to be able to represent the dependencies implied by those expressions. However, the assumption that configuration is mostly ignored when planning destroy is load-bearing for minimizing awkward dependency problems in the destroy-planning graph, so this introduces a new concept of "destroy references" which means that we can implement only a small, curated subset of references -- for now, just the ones from prevent_destroy -- that get considered for any node type that implements GraphNodeDestroyer. Having GraphNodeDestroyer effectively take priority over GraphNodeReferencer seems like the least disruptive way to retrofit this idea surgically as a small change to the previous unilateral rule against any references at all, because in practice all of the destroy nodes embed NodeAbstractResourceInstance and therefore implement GraphNodeReferencer, so it is important that we continue to ignore that type's GraphNodeReferencer implementation whenever it's embedded in something that is also a GraphNodeDestroyer. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>