terraform: orphaned grandchild module inherits provider config #9318
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes an issue where orphaned grandchild modules don't properly
inherit their provider configurations from grandparents. I found this
while working on shadow graphs (the shadow graph actually caught an
inconsistency between runs and exposed this bug!), so I'm unsure if this
affects any pre-existing issues.
To better explain the issue, I'll diagram things.
Here is a hierarchy that works (w/o this PR):
All modules in this case will successfully inherit provider
configurations from "root".
Here is a hierarchy that doesn't work without this PR:
In this case,
child1
does successfully inherit the provider from root,but
grandchild
will not unlesschild1
had resources. Ifchild1
has no resources, it wouldn't inherit anything. This PR fixes that.