尝试构建自定义的 Terraform 提供程序时,遇到了 helpers/schema 模块的错误。

huangapple go评论73阅读模式
英文:

Attempting to build a custom terraform provider, encountering errors with the helpers/schema module

问题

我先说一下,我完全是新手,对Go语言的环境一头雾水。

我正在尝试按照这个指南的说明来创建一个自定义的Terraform提供程序。

在设置好项目文件后,当我尝试运行go mod tidy时,它无法拉取所需的模块。这是我得到的错误信息:

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

对于几乎所有的要求,我都得到了同样的错误。

有人能否以儿童语言解释一下,我应该如何设置我的Go环境,以便能够编写自定义的Terraform提供程序?谢谢。

英文:

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.

答案1

得分: 1

你正在遵循的指南非常过时(来自2014年)。自从那时起,他们已经多次重新组织了插件SDK,稍微更新的是我相信是terraform-plugin-sdk,但我不建议学习它。最新且推荐的SDK被称为terraform-plugin-framework

这里有最新的文档和示例:使用Terraform插件框架实现提供者。它将指导你设置环境并引导一个新的自定义提供者。

英文:

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.

huangapple
  • 本文由 发表于 2022年10月7日 12:22:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/73982347.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定