首页 > 解决方案 > Terraform 社区提供者是否被视为第三方?

问题描述

我正在准备Terraform Associate 认证考试。我在 Udemy 上进行了一次练习考试,并收到了一个关于自动安装社区提供程序的问题。但是,根据实际terraform行为,我质疑考试(或 Terraform 的文档)是否不正确。可能我的问题应该针对练习考试的作者,但我想我会在这里发布,以防澄清可能对其他人有所帮助。

考试题目是:

对或错?terraform init无法自动下载社区提供程序。

我的回答是false,根据考试不正确,解释如下:

解释

任何人都可以开发和分发他们自己的 Terraform 提供程序。(有关提供程序开发的更多信息,请参阅编写自定义提供程序。)这些第三方提供程序必须手动安装,因为 terraform init 无法自动下载它们。

https://www.terraform.io/docs/configuration/providers.html#third-party-plugins

Terraform 的init文档证实了这一点(注意没有提到社区插件):

请注意,terraform init 无法自动下载不是由 HashiCorp 分发的提供程序。有关安装说明,请参阅下面的第三方插件。

但是,如果您将社区提供程序添加到您的配置并运行terraform init社区插件请自动安装:

provider "auth0" {
  version = "> 0.8"
}
$ terraform init

Initializing the backend...

Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "auth0" (terraform-providers/auth0) 0.10.2...
...

所以我只能假设基于实际的 terraform 功能社区提供者不被视为第三方插件?

标签: terraform

解决方案


The documentation and practice exam are both based on outdated information. Formerly, that answer and documentation were both correct, and you were forced to manually install custom providers. The method and process described in the documentation was completely accurate.

However, on January 15th, 2020, the Terraform registry was expanded to provide functionality for community providers in addition to community modules. The official announcement from Hashicorp can be viewed here. Now the method you described (which also functioned for third party modules) is valid. You can also view the provider registry which makes this possible. Note that Terraform Cloud and Terraform Enterprise both also provide private registries with this functionality.

Updated notes: actually, Terraform Cloud's private registry is limited to modules at the moment, including with a VCS connected provider. However, the TF Cloud Registry interface implies the feature will come eventually. Also, the community provider support is expanding further with Terraform 0.13 release notes.

On a side note, I would not currently trust in the integrity of any third-party study guides for Hashicorp certifications. The exams only recently exited beta. I am struggling to find the announcement (it was either in an official blog post or a partner email), but it was after mid-April 2020. When I acquired my Terraform (late January 2019) and Vault (early April 2020) certifications, both were still in beta, and this was evident by interesting occurrences in the exams, such as a few questions being repeated verbatim. I would trust the official Hashicorp study guide more than anything else at the moment.


推荐阅读