-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
terraform: Further generalization of the EvalContext scope handling
This is a continuation of some restructuring started in earlier commits: 641837d 42f012b 079021d In those earlier commits my goal was to minimize breaking changes to the EvalContext API to churn existing code as little as possible. However, the way I achieved that was to handle fully-expanded modules and partial-expanded modules as two completely separate codepaths, which means that all other code must statically decide which of the two cases it's dealing with even though there's not really any reason the EvalContext implementation couldn't support that being decided dynamically. For the "deferred actions" work, in a future commit we'll need to introduce a new graph node type representing partial-expanded resources which must decide dynamically whether it's in a fully-expanded module scope or a partial-expanded module scope, because the treatment is quite different for a fully-expanded module containing a resource with unknown expansion vs. a resource that's inside a module that hasn't been expanded itself. This is therefore the logical conclusion of the previous work, making "eval context scope" the primary way that we talk about where an eval context is doing its work, with a helper function for the common case where that's a fully-expanded ModuleInstance. In particular, this includes a third variation of the family of interfaces that have method Path indicating the scope that the node should be evaluated in, which is allowed to return any non-nil evalContextScope chosen dynamically at runtime. The existing interfaces that statically return addrs.ModuleInstance and addrs.PartialExpandedModule remain as statically-typed alternatives for the common case, since the need to decide dynamically is (for now) limited only to nodes representing addrs.PartialExpandedResource addresses. This has unfortunately now churned a little more code than I originally wanted to, but the helper functions and the retaining of the statically-typed node-scope-discovery interfaces has kept it as small as possible. (This also continues our effort to gradually make the implementation details of package terraform be unexported, at the expense of a little inconsistency in the short term where these new fields/types are mixed in with exported fields/types. Hopefully we'll continue on this quest over time and eventually reach things being consistently unexported.)
- Loading branch information
1 parent
64cd0da
commit 34ccf28
Showing
18 changed files
with
129 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.