How to test custom build of azurerm provider

I’ve followed the instructions in the readme here https://github.com/terraform-providers/terraform-provider-azurerm for building a small change to the provider. I have the binary correctly output to $GOPATH/bin/terraform-provider-azurerm now I want to test and see if my change fixes my problem.

Reading the following document https://www.terraform.io/docs/extend/how-terraform-works.html#discovery it sounds like I should be able to run terraform init -plugin-dir=$GOPATH/bin but I get the following output

$ terraform init -plugin-dir=$GOPATH/bin

Initializing the backend...

Initializing provider plugins...
- Finding latest version of hashicorp/azurerm...

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider
hashicorp/azurerm: provider registry.terraform.io/hashicorp/azurerm was not
found in any of the search locations

- /home/jshare/go/bin

I’ve also tried copying the binary to . and to terraform.d/plugins/linux_amd64/ both of which the above document claim should be searched before downloading, but no success.

I feel like I’m missing something basic in the docs. Anyone able to point me in the right direction?

After reading the Makefile on the tutorial repository https://github.com/hashicorp/terraform-provider-hashicups/blob/master/Makefile and supplementing with information from the CLI docs https://www.terraform.io/docs/commands/cli-config.html#explicit-installation-method-configuration I’ve landed on the following command that seems to work.

cp ~/go/bin/terraform-provider-azurerm ~/.terraform.d/plugins/registry.terraform.io/hashicorp/azurerm/1.0/linux_amd64/

I’m still open for input on whether this is the correct/recommended way to do manual testing of locally built providers.

1 Like