configs: Fix provider lookup local name mismatch #26871
Merged
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.
When a resource has no
provider
argument specified, its provider is derived from the implied provider type based on the resource type. For example, aboop_instance
resource has an implied provider local name ofboop
. Correspondingly, its provider configuration is specified with aprovider "boop"
block.However, users can use the
required_providers
configuration to give a different local name to a given provider than its defined type. For example, a provider may be published atfoobar/beep
, but provide resources such asboop_instance
. The most convenient way to use this provider is with arequired_providers
map:Once that local name is defined, it is used for provider configuration (a
provider "boop"
block, notprovider "beep"
). It should also be used when looking up a resource's provider configuration or provider.This commit fixes a bug with this edge case, where previously we were looking up the local provider configuration block using the resource's assigned provider type. Instead, if no provider argument is specified, we should be using the implied provider type, as that is what binds the resource to the local provider configuration.
Specifically fixes #26868, where a
onepassword
provider offering resources likeonepassword_item_login
has been published atmilosbackonja/1password
. With this commit, the provider mapping in the original report works as expected (and documented). More details and diagnosis over in the issue.Assuming this passes review, I think this may be a candidate for an 0.14 backport, despite the very close RC. Any concerns with backporting?