首页 > 解决方案 > 安装 hashcorp/azurerm v2.73.0 时出错:打开

问题描述

使用 terraform v1.0.5的terraform init命令失败并出现以下错误:

- Installing hashicorp/azurerm v2.73.0...
2021-09-02T17:53:54.661-0700 [TRACE] providercache.Dir.InstallPackage: installing registry.terraform.io/hashicorp/azurerm v2.73.0 from https://releases.hashicorp.com/terraform-provider-azurerm/2.73.0/terraform-provider-azurerm_2.73.0_windows_amd64.zip
2021-09-02T17:53:54.661-0700 [TRACE] HTTP client GET request to https://releases.hashicorp.com/terraform-provider-azurerm/2.73.0/terraform-provider-azurerm_2.73.0_windows_amd64.zip
2021-09-02T17:54:24.762-0700 [DEBUG] Provider signed by 34365D9472D7468F HashiCorp Security (hashicorp.com/security) <security@hashicorp.com>
╷
│ Error: Failed to install provider
│
│ Error while installing hashicorp/azurerm v2.73.0: open
│ .terraform\providers\registry.terraform.io\hashicorp\azurerm\2.73.0\windows_amd64\terraform-provider-azurerm_v2.73.0_x5.exe: The system cannot find the path
│ specified.
╵

我们删除了所有无关的 terraform 代码以将问题隔离到简单的提供程序配置。

触发此错误的最小示例的完整代码包括模块定义和对该模块定义的调用。

对模块定义的最小调用的完整代码是:

module "name-of-module" {
  source = "..\\..\\..\\..\\modules\\name-of-module"

  subscriptionId     = var.subscriptionId
  tenantId           = var.tenantId
  clientId           = var.clientId
  clientSecret       = var.clientSecret
  resourceGroupName  = var.resourceGroupName
  pipeAzureRegion    = var.resourceGroupRegion

}

##Input variables.  The client referred to is an App Registration.
variable "subscriptionId" { }
variable "tenantId" { }
variable "clientId" { }
variable "clientSecret" { }
variable "resourceGroupName" { }
variable "resourceGroupRegion" { }

最小模块定义的完整代码是:

variable "subscriptionId" { }
variable "tenantId" { }
#The client referred to is an App Registration.
variable "clientId" { }
variable "clientSecret" { }
variable "resourceGroupName" { }
variable "pipeAzureRegion" { }

terraform {

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=2.73.0"
    }
  }
}

provider "azurerm" {
    subscription_id = var.subscriptionId
    client_id       = var.clientId
    client_secret   = var.clientSecret
    tenant_id       = var.tenantId

    features { }

}

那是 100% 的代码。我们删除了所有其他内容以隔离问题的可能原因。

是什么导致我们在上面发布的错误消息?

标签: azureterraformterraform-provider-azure

解决方案


推荐阅读