Repository navigation
use target patterns for test overrides (5/8) - #39352
Merged
Merged
Conversation
jbardin
force-pushed
the
jbardin/target-patterns-D
branch
from
October 8, 2026 15:28
82d4781 to
e4cae21
Compare
The targets of override blocks in test files and mock providers are parsed as target patterns, so an override of a module call or resource without an instance key applies to every instance. Override targets are stored in addrs.Map[addrs.TargetPattern, *Override], and Config.TargetExists checks the configuration address of the pattern. Overrides are found by matching their targets against each address, and the most specific of the matching overrides is used. Overrides from the test configuration take precedence over those from mock providers with the same target.
jbardin
force-pushed
the
jbardin/target-patterns-E
branch
from
October 8, 2026 15:47
3af93a7 to
1560520
Compare
jbardin
marked this pull request as ready for review
October 8, 2026 15:50
mildwonkey
previously approved these changes
Oct 8, 2026
mildwonkey
left a comment
Contributor
There was a problem hiding this comment.
At this point I'm approving based on the past PRs, tests, and general design pattern more than specific changes (I don't know test well) but this all still looks reasonable!
mildwonkey
approved these changes
Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The targets of override blocks in test files and mock providers are parsed as target patterns, so an override of a module call or resource without an instance key applies to every instance. Override targets are stored in addrs.Map[addrs.TargetPattern, *Override], and Config.TargetExists checks the configuration address of the pattern.
Overrides are found by matching their targets against each address, and the most specific of the matching overrides is used. Overrides from the test configuration take precedence over those from mock providers with the same target.