Is it possible to make terraform cli to consider the “provider_installation” block in the
.tf file rather than the cli configuration file
Terraform cli configuration are user-specific right? Don’t want this change to be done by each user. Instead, if we can make terraform cli to consider the provider_installation" block in the
.tf file it will be a one-time change. Correct me if my understanding is wrong.
I’ve split your question into a separate topic because the one you replied to was an old, concluded topic and your new question seems only thematically related to it, not actually following on from it.
The provider installation configuration is intentionally something that is a per-user or per-computer thing, because the typical reason for overriding the default behavior is that a particular system is either physically unable to access origin registries or has some regulation/policy imposed on it that makes that inappropriate, but that constraint would not necessarily apply to other systems where Terraform is used.
You didn’t say here what has prompted you to want to set up custom installation settings for all users, but if you can say more about that then I might be able to suggest a different strategy to accomplish your goal within the intended usage patterns, rather than using the provider installation settings for a purpose different than they were intended to address.
Thanks for the reply.
The use case is:
We wrote a custom provider and we want to keep that as private. So we hosted that in one of our static servers and we are following the provider network mirror protocol ie…, updating index.json and uploading version.json in the static server whenever we release a new version of terraform provider.
We also wrote some custom modules using this provider. Right now we are asking the internal users who want to use this provider/custom module to have the
provider_installation block in their
.terraformrc file, which will make the terraform cli to fetch the provider from the static server.
Don’t want each and every internal user to make this change in their
.terraformrc. Seeking for something that we can make common for everyone.
If you want your users to be able to access your private providers (and modules) without changing their local
.terraformrc, you can implement the provider registry protocol and module registry protocol. These are only a little more involved than the provider network mirrors specification.
Martin has written and released a sample implementation of the module registry protocol here which you may find a useful starting point. Hope this helps!