mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 00:41:27 -06:00
45b04c826a
For child modules, a ModuleState isn't allocated until the first time a module instance is inserted into the state under the module's path. Normally interpolations of resource attributes are delayed until at least one resource has been created due to the nature of the dependency graph, but if the interpolation value is a multi-var (splat) then it is possible that the referenced resource has count=0 and thus created _no_ resource states when it was visited. Previously we would crash when trying to access the resource map for the nil module in order to count how many instances are present. Since we know there can't be any instances present in a nil module, we now preempt this crash by returning zero early. This edge-case does not apply to the root module because its ModuleState is allocated as part of initializing the main State instance. This fixes #14438. |
||
---|---|---|
.. | ||
child | ||
root.tf |