Using an In-house Provider with Terraform v0.14
Ever wanted to update a Terraform Provider and not use the hosted Registry? Here at Pure Storage we have a Terraform Provider for Cloud Block Store and I wanted to do some testing myself. I started to pull my hair out trying to get Terraform to use my locally built provider instead of the registry. Check out this blog for a few simple steps to use a local in-house provider instead of the registry!
As I tried to get this working I found a couple blogs and articles that showed how easy this was in v0.12, and that all changed in v0.13. I tried to follow some of those and still got lost. Eventually I found a Hashicorp blog that covered this, and I really wish it was in the documentation
This is the way
I eventually stumbled across this Hashicorp blog which covered some of the changes in v0.13. Turns out its fairly simple again.
To use a In-house (local) provider you just need to place it in the following path
$PLUGIN_DIRECTORY/$SOURCEHOSTNAME/$SOURCENAMESPACE/$NAME/$VERSION/$OS_$ARCH/
In my case it was the folllowing directory as I am using MacOSX.
~/.terraform.d/plugins/local/test/cbs/99.0.0/darwin_amd64/
Once the directory is created place your provider in the final nested folder named terraform-provider-cbs in my case.
You will then need to add the following code to your main.tf
1terraform {
2 required_providers {
3 cbs = {
4 source = "local/test/cbs"
5 version = "99.0"
6 }
7 # add other providers here
8 }
9 required_version = ">= 0.13"
10}
Once added you can run terraform init and have your In-house provider installed!
Conclusion
Super easy right? Well it took myself a couple hours to figure out going through countless number of blogs and documentation. Hope this has helped you!
If you have any additional questions or comments, please leave them below!
comments powered by DisqusSee Also
- Using the Pure Storage Cloud Block Store Terraform Provider for Azure
- Cloud Block Store Use Cases for Microsoft Azure - Terraform Edition
- Using the Pure Storage Cloud Block Store Terraform Provider for AWS
- Deploying a Linux EC2 Instance with Hashicorp Terraform and Vault to AWS and Connect to Pure Cloud Block Store
- Deploying a Windows Azure VM with Hashicorp Terraform to Microsoft Azure