-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add token mapping strategies with inferred fallback #2882
Add token mapping strategies with inferred fallback #2882
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2882 +/- ##
==========================================
+ Coverage 67.74% 67.76% +0.02%
==========================================
Files 328 329 +1
Lines 42116 42176 +60
==========================================
+ Hits 28531 28581 +50
- Misses 11994 12003 +9
- Partials 1591 1592 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we can't expose a much simpler tokens.CombineStrategies(strategies ...Strategy) Strategy
api?
The tokens.CombineStrategies
would just try each strategy in turn until one works.
KnownModulesWithInferredFallback
and MappedModulesWithInferredFallback
seems like specialization that adds complexity.
We could but that'd expose a wider public area which we are committing to maintaining. The WithInferredFallback variants are our only current use case for CombineStrategies and expose a much narrower surface area. This will in turn allow us to
In addition, because some of the config is shared, we can use the first strategy inputs to configure the InferredModules strat and automate the whole migration for all providers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you summarize what this change does, and when it would apply?
Holding for @iwahbe to respond to your comment.
Thank you for all these improvements!
We are already committed to exposing the strategy for
That design makes me pretty uncomfortable. Field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at this API, I'm wondering if we want to distinguish error types. The safest thing to do would be to introduce a StrategyDoesNotApply
error, and then only forward calls when the strategy returns an error that wraps that.
This would allow stratagies to signal critical failures vs simply not applying.
96c5241
to
de71ddd
Compare
de71ddd
to
1b54efe
Compare
a2dd441
to
cac2b8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 nits in the documentation, then LGTM
This PR has been shipped in release v3.103.0. |
This PR adds two new token mapping strategies for providers which add a fallback to the InferredModules strategy:
This should make token mapping for all providers easier since we can migrate all KnownModules providers to KnownModulesWithInferredFallback and all MappedModules to MappedModulesWithInferredFallback
The two strategies are written to make automated migrations using
gopatch
easy and are separated in a different module.Related to pulumi/ci-mgmt#1347