Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stacks: validate providers based on types instead of local names #34735

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

liamcervante
Copy link
Member

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 the LocalProviderConfig 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.

@liamcervante liamcervante requested a review from a team February 27, 2024 10:46
Copy link
Member

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems plausible to me!

As usual with these things that sit on the boundary between two modules, this is kinda hard to scan and "mentally execute", but I can't think of any specific way to improve that; it's also true of the similar logic in the modules runtime for dealing with module blocks.

@liamcervante liamcervante merged commit cec4b7b into main Feb 28, 2024
6 checks passed
@liamcervante liamcervante deleted the liamcervante/stacks/validate-provider-types branch February 28, 2024 07:24
Copy link

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants