mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-21 18:56:57 -05:00
The previous approach had the problem that we only had the CompiledModuleInstance object for a child module briefly in a local variable while evaluating the child call, which is sufficient for just evaluation but is not enough to support full config tree traversal for questions like "what resource instances are declared throughout the configuration?" and "what configgraph node corresponds to this provider configuration instance address?" This moves the separation of concerns around a little to be perhaps more like how resource instances work, where the ModuleCallInstance.Value method just wraps a function provided by the "compile" layer which then takes the config value and compiles the child module instance. This means that the "compile" layer can then hold on to the CompiledModuleInstance object for the child module instance as part of the "glue" in the ModuleCallInstance object and then use it to deal with the config-tree-traversing methods in its own CompiledModuleInstance implementation. The new test of ConfigInstance.PrepareToPlan in lang/eval illustrates that the system is now finally able to walk the whole configuration tree to find resource instances and the provider instances they depend on. (The handling of inheritance of providers between parent and child module instances is still not working like the current system does, because the "providers sidechannel" mechanism remains incomplete. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
4.3 KiB
4.3 KiB