I'll start off by saying I'm completely new to Go and having a lot of trouble figuring out its environment.
I'm attempting to make a custom terraform provider by following the instructions in this guide.
When attemping to run go mod tidy
after setting up the project files, it is unable to pull in the required modules. This is the error I get:
github.com/hashicorp/terraform/terraform: module github.com/hashicorp/terraform@latest found (v.1.3.2), but does not contain package github.com/hashicorp/terraform/terraform
I get this same error for pretty much all the requirements.
Can someone ELI5 how I'm supposed to setup my Go environment so that I can write a custom tf provider? Thanks.
CodePudding user response:
The guide you are following is terribly outdated (from 2014). Since it was written, they reorganized plugin SDK several times, slightly newer is I believe terraform-plugin-sdk
which I don't recommend learning at all. Latest and recommended SDK is called terraform-plugin-framework
.
Up to date documentation with examples is here: Implement a Provider with the Terraform Plugin Framework. It will walk you trough environment setup and bootstrapping a new custom provider.