stacks: validate providers based on types instead of local names #34735
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.
Currently, stacks resolves provider types entirely by doing reverse look ups against the local name of the provider within the stack configuration. It then tries to resolve the provider map within components by looking up the provider entries by that local name. There is no guarantee that the local names between the component configs and the stack configs will match up.
This PR makes the
RequiredProviderInstances
lookup function also return theLocalProviderConfig
address. This means we can look up the local name for the required provider in the stack configuration separately to resolving the local name within the component configuration.We also expand the static analysis so that it checks the type of the returned references (to make sure they are referencing providers). The dynamic analysis now doesn't repeat the same set of checks as the static analysis, with the providers required by the state processed separately to the configuration providers.