在 Azure Pipeline 中运行的 Terraform 尝试安装 azcli 提供程序 [英] Terraform running in Azure Pipeline attempting to install azcli provider
问题描述
我正在 Azure Pipeline 中运行 Terraform(我有这样做的经验),并且出于某种原因,初始化步骤正在尝试为 azcli 安装提供程序,但我认为该提供程序不存在.当我在本地计算机上运行 Terraform 时,不会发生这种情况.
I'm running Terraform in an Azure Pipeline (something I have experience of doing) and for some reason the init step is attempting to install a provider for azcli, which I don't think exists. This does not happen when I run Terraform on my local machine.
我的提供者文件是:
terraform {
required_version = ">=0.13"
backend "azurerm" {
container_name = "tfstate"
key = "terraform.tfstate"
}
required_providers {
grafana = {
source = "grafana/grafana"
version = "=1.5.0"
}
}
}
这是我看到的错误:
我不确定 Terraform 为什么要尝试安装 azcli 提供程序;我认为它甚至不存在.有人见过这个吗?
I'm not sure why Terraform is trying to install the azcli provider; I don't think it even exists. Has anyone seen this before?
推荐答案
Terraform 在初始化时直接和间接地搜索提供程序.资源名称或提供者定义中可能存在错误.在您的代码库中搜索 azcli.
Terraform searches directly and indirectly for providers when initialization. It is possible there is a mistake in the resource name or provider definition. Search your codebase for azcli.
▶ cat .main.tf
resource "azcli_test" "test" {
test = "true"
}
~projects est 5 ◷ 10:10:21 AM
▶ C:Userspearcecin erraform init
Initializing the backend...
Initializing provider plugins...
- Finding latest version of hashicorp/azcli...
Error: Failed to install provider
Error while installing hashicorp/azcli: provider registry
registry.terraform.io does not have a provider named
registry.terraform.io/hashicorp/azcli
或
~projects est 5 ◷ 10:10:23 AM
▶ cat .main.tf
provider "azcli" {
features {}
}
~projects est 5 ◷ 10:13:41 AM
▶ C:Userspearcecin erraform init
Initializing the backend...
Initializing provider plugins...
- Finding latest version of hashicorp/azcli...
Error: Failed to install provider
Error while installing hashicorp/azcli: provider registry
registry.terraform.io does not have a provider named
registry.terraform.io/hashicorp/azcli
或
▶ cat .main.tf
terraform {
required_providers {
azcli = {
source = "-/azcli"
}
}
}
~projects est 5 ◷ 10:16:09 AM
▶ C:Userspearcecin erraform init
Initializing the backend...
Initializing provider plugins...
- Finding latest version of -/azcli...
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider -/azcli:
provider registry registry.terraform.io does not have a provider named
registry.terraform.io/-/azcli
这篇关于在 Azure Pipeline 中运行的 Terraform 尝试安装 azcli 提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!