Commit Graph

4 Commits

Author SHA1 Message Date
James Bardin 89a8624d8c instances: staticcheck 2020-12-02 13:59:19 -05:00
James Bardin 14ec3e6078 Expander.ExpandResource cannot expand all modules
ExpandResource must only check the specific ModuleInstances in the
requested path, because the resource may not have been registered yet in
all module instances.
2020-03-25 11:58:23 -04:00
James Bardin 0d58537bf2 Expander.ExpandResource
It turns out that within terraform resource expansion will normally
happen with an absolute address. This is because in order to evaluate
the expansion expression, we need to already have the context within a
module instance.

This leaves the existing ExpandResource logic in place as
ExpandModuleResource since it's working, and in case we do find a
location where it's useful to get a full expansion (which may be needed
for instance dependency tracking)

Reword some of the resource related arguments and comments, as they were
copied from the module methods and not entirely accurate.
2020-03-24 12:12:41 -04:00
Martin Atkins 1dece66b10 instances: A package for module/resource reptition
This package aims to encapsulate the module/resource repetition problem
so that Terraform Core's graph node DynamicExpand implementations can be
simpler.

This is also a building block on the path towards module repetition, by
modelling the recursive expansion of modules and their contents. This will
allow the Terraform Core plan graph to have one node per configuration
construct, each of which will DynamicExpand into as many sub-nodes as
necessary to cover all of the recursive module instantiations.

For the moment this is just dead code, because Terraform Core isn't yet
updated to use it.
2020-02-14 15:20:07 -08:00