hashicorp保险库需要在Terraform中的提供商配置
我的 GitLab CI 管道 terraform 配置需要声明几个 required_provider 块。这些是“hashicorp/azuread”和“hashicorp/vault”,因此在我的provider.tf文件中,我给出了以下声明:
terraform {
required_providers {
azuread = {
source = "hashicorp/azuread"
version = "~> 2.0.0"
}
vault = {
source = "hashicorp/vault"
version = "~> 3.0.0"
}
}
}
但是,当我的GitLab管道运行terraform计划阶段时,它会抛出以下错误:
Error: Invalid provider configuration
Provider "registry.terraform.io/hashicorp/vault" requires explicit configuraton.
Add a provider block to the root module and configure the providers required
arguments as described in the provider documentation.
我意识到我需要hashcorp/vault 的提供程序块不完整/未正确配置,但尽管我尽了最大努力寻找如何配置它的示例,但我只是遇到了砖墙。
任何有关非常基本示例的帮助将不胜感激。
My GitLab CI pipeline terraform configuration requires a couple of required_provider blocks to be declared. These are "hashicorp/azuread" and "hashicorp/vault" and so in my provider.tf file, I have given the below declaration:
terraform {
required_providers {
azuread = {
source = "hashicorp/azuread"
version = "~> 2.0.0"
}
vault = {
source = "hashicorp/vault"
version = "~> 3.0.0"
}
}
}
When my GitLab pipeline runs the terraform plan stage however, it throws the following error:
Error: Invalid provider configuration
Provider "registry.terraform.io/hashicorp/vault" requires explicit configuraton.
Add a provider block to the root module and configure the providers required
arguments as described in the provider documentation.
I realise my required provider block for hashicorp/vault is incomplete/not properly configured but despite all my efforts to find an example of how it should be configured, I have simply run into a brick wall.
Any help with a very basic example would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您使用的 Terraform 版本。但是,对于每个提供程序,(在右上角)都有一个
使用提供程序
按钮,该按钮解释了如何将所需的代码块添加到您的文件。每个提供商都有一些可以添加的附加配置参数,其中一些是必需的。
因此,根据错误,我认为您缺少配置的第二部分:
还有关于如何 升级到提供商版本 3.0。您可能还想查看 Hashicorp Learn 示例 和 < a href="https://github.com/hashicorp/vault-guides" rel="nofollow noreferrer">带有示例代码的 Github 存储库。
It depends on the version of Terraform you are using. However, for each provider there is (in the top right corner) a
Use Provider
button which explains how to add the required blocks of code to your files.Each provider has some additional configuration parameters which could be added and some are required.
So based on the error, I think you are missing the second part of the configuration:
There is also an explanation on how to upgrade to version 3.0 of the provider. You might also want to take a look at Hashicorp Learn examples and Github repo with example code.