core: Input walk shouldn't clobber dynamic provider config #13264
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.
During the input walk we stash the values resulting from user input (if any) in the eval context for use when later walks need to resolve the provider config.
However, this repository of input results is only able to represent literal values, since it does not retain the record of which of the keys have values that are "computed".
Previously we were blindly stashing all of the results, failing to consider that some of them might be computed. That resulted in the UnknownValue placeholder being misinterpreted as a literal value when the data is used later, which ultimately resulted in it clobbering the actual expression evaluation result and thus causing the provider to fail to configure itself.
Now we are careful to only retain in this repository the keys whose values are known statically during the input phase. This eventually gets merged with the dynamic evaluation results on subsequent walks, with the dynamic keys left untouched due to their absence from the stored input map.
This fixes #11264.
This is a pretty insidious one since the bug is during the input walk but its effects are not felt until we try to configure the provider in either the refresh or plan walk.