-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
improve error when missing required_providers
causes lookup in hashicorp
namespace
#31645
Comments
Hi @roy-work, Sorry you're having trouble with this, does the output of the suggested command of In general, all modules must have the correct Since you mention that you recently added a resource to a module, that module would be the first place I check to ensure it has the cloudflare provider listed in While Terraform is working correctly here, perhaps there is a way we can try to correlate a possible source of the incorrect configuration for the |
required_providers
causes lookup in hashicorp
namespace
Good grief. So, if you take the recommended advice of running
So you keep tugging that root:
Which is then becomes a loop. Surprisingly, if you go actually, for whatever reason, decide to go around the loop again, despite those commands both failing, some progress apparently did happen during the previous failures!
… so I'll admit I missed that in the original error, but … just do the resolution for the user, and make it obvious?
… I feel like I've struggled with this through any number of breaking changes in TF. |
Hello, I am experiencing the same issue with |
So, we were facing this error message for the planning stage: |
Hello, I am facing the same issue when i use terraform init command. Is there any way to resolve or bypass this problem? @jbardin |
@toMyLord, you likely have a module missing the necessary Thanks! |
@jbardin, thanks for your reply. Actually I had added the necessary required_providers entry before used terraform init command. Those are error messages.
It seems like terraform try to find two providers from xxx.com/yyy and hashicorp/zzz, but I had set the required_providers like this:
ps: I hadn't uploaded my providers(xxx.com/yyy/zzz) to any registry. instead, I had used mkdir command to build the path Anyway, thank you again and I will be looking forward to you reply. |
As I try terraform plans I get about 85% through and then
The cruel and unusual part of this is I am not using or calling that provider at all.
So what is going on here? This just started happening this morning. |
Currently I am facing identical issue but with Azure/azapi provider. copy paste required_providers from my
below:
And it returns me an error like below:
then when I do above error instruction I will get another error:
And when I change to Any recommendations to resolve this issue? |
I actually fixed mine by running |
The documentation and errors about this are very unclear. @jbardin When you referenced the documentation above about the The documentation says that providers are inherited; then says the entire terraform_block is required; then says that modules shouldn't define provider information. And, indeed, this is the case with the Build and Use Terraform modules tutorial - the aws s3 bucket module that's created has no provider reference nor terraform{} block in it. But even the error that's thrown says, In any case, I cannot get any module to work without explicitly duplicating the terraform{} block inside each and every module I create and reference from the root module. Is this a bug or by design per the error text? |
@blue928, If a provider is not in the default hashicorp namespace, terraform needs to know exactly which provider is used within the module., so that is working as designed. To quote the linked documentation above:
|
This is something I've run into as well. It seems to be passing only the provider object itself (from the
If each called module is inheriting the provider, shouldn't it inherit everything that the calling module knows about the provider as well? That would make a lot more sense, especially when considering that the calling module's If just that bit of information were inherited alongside the This issue could also be solved by adding/allowing a meta-argument in |
Terraform Version
Terraform Configuration Files
Add a new module using Cloudflare records, but "forget" (i.e., not even realize you need) to add:
Non-Debug Output
Debug output
The debug output, which isn't much more informative, either.
Expected Behavior
The diagnostics emitted by a non-debug run of Terraform are informative, and useful, enough so to locate & fix the issue.
Actual Behavior
I got the above diagnostic.
The diagnostic is correct that, yes, I do intend
cloudflare/cloudflare
. So my question here is "what is installinghashicorp/cloudflare
?" and the diagnostic just hangs me out to dry in that regard. No clues. In the change that triggered this, I'm not attempting to change what providers are installed: I'm merely addingcloudflare_record
resources, so I'm doubly confused.rg
thinks I'm not using it:I check the lock file:
So now I'm really confused. Why is this provider being installed?
Steps to Reproduce
… with a module missing the provider section that requires a provider section.
Additional Context
We use TFE.
in the module. I have no idea why a providers section is sometimes required, and when it is, it continually bites me in the ass like this, and the diagnostics are no help in getting me to realizing that TF is biting me in the ass in this particular manner. To me, either one of the following should hold true:
cloudflare_*
in the main workspace, so we don't need to suddenly invent a provider name and try to download some random stuff that doesn't exist.But I have no explanations for TF's behavior. It isn't consistent, nor predictable. I've merely learned to recognize this particular pit, when I'm in it.
References
The text was updated successfully, but these errors were encountered: