Hi, when developing a custom provider I often want to run terraform with a local built copy of my provider. With Terraform 0.12 this was possible by simply putting the provider in the same directory, with Terraform 0.13 this doesn’t work any more.
I’ve been trying to piece together the workflow from the documentation, but I can’t get it working. Terraform init either downloads the provider from the registry or complains it can’t find the provider.
Sorry that this is so awkward to get started with! Ideally there would be a much easier way to install providers locally, especially for testing and development. Something like a terraform providers install command would be welcome.
All providers must have a version. For local development, it might make sense to use the next version (e.g. 0.0.7), or a much higher version than you have released (e.g. 99.0.0).
Not quite: the OS/arch for a macOS system should be darwin_amd64, not Darwin. It’s also conventional to add the version number to the end of the binary, separated by underscore.
version = 99.0.0
provider_path = registry.terraform.io/kvrhdn/honeycombio/$(version)/darwin_amd64/
install_macos:
go build -o terraform-provider-honeycombio_$(version)
mkdir -p ~/Library/Application\ Support/io.terraform/plugins/$(provider_path)
cp terraform-provider-honeycombio_$(version) ~/Library/Application\ Support/io.terraform/plugins/$(provider_path)
And when I run terraform init:
Initializing the backend...
Initializing provider plugins...
- Finding latest version of kvrhdn/honeycombio...
- Installing kvrhdn/honeycombio v99.0.0...
- Installed kvrhdn/honeycombio v99.0.0 (unauthenticated)
The following providers do not have any version constraints in configuration,
so the latest version was installed.
To prevent automatic upgrades to new major versions that may contain breaking
changes, we recommend adding version constraints in a required_providers block
in your configuration, with the constraint strings suggested below.
* kvrhdn/honeycombio: version = "~> 99.0.0"
Terraform has been successfully initialized!
Is there a cross-platform way to generate the darwin_amd64 part?