AKS 集群 |无法查询可用的提供程序包 |正确版本的 hashicorp
AKS Cluster | Failed to query available provider packages | Right version of hashicorp
我目前正在制定我的 terraform 计划,似乎 运行一旦我 运行 执行以下命令,我就会遇到问题:
terraform init
当前main.tf包含这个:
terraform {
backend "azurerm"{
resource_group_name = "test"
storage_account_name = "testaccount"
container_name = "testc"
key = "testc.state"
}
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "2.46.0"
}
}
}
# Configure the Microsoft Azure Provider
provider "azurerm" {
features {}
}
data "azurerm_key_vault" "keyVaultClientID" {
name = "AKSClientID"
key = var.keyvaultID
}
data "azure_key_vault_secret" "keyVaultClientSecret" {
name = "AKSClientSecret"
key_vault_id = var.keyvaultID
}
resource "azurerm_kubernetes_cluster" "test_cluster" {
name = var.name
location = var.location
resource_group_name = var.resourceGroup
dns_prefix = ""
default_node_pool {
name = "default"
node_count = 1
vm_size = "Standard_D2_v2"
}
service_principal {
client_id = data.azurerm_key_vault_secret.keyVaultClientID.value
client_secret = data.azurerm_key_vault_secret.keyVaultClientSecret.value
}
tags = {
"Environment" = "Development"
}
}
我收到的错误消息如下:
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/azure: provider
│ registry registry.terraform.io does not have a provider named
│ registry.terraform.io/hashicorp/azure
我正在查看文档,并且正在更改版本,但我没有得到任何运气。有谁知道我还能做什么或我应该在 main.tf 上更改什么?
要解决此问题,您必须在主地形规划中添加以下内容:
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.75.0"
}
如果你加上它,这个问题就再也不会出现了。此外,您可能必须 运行 升级命令以确保 terraform 能够处理新版本。
我目前正在制定我的 terraform 计划,似乎 运行一旦我 运行 执行以下命令,我就会遇到问题:
terraform init
当前main.tf包含这个:
terraform {
backend "azurerm"{
resource_group_name = "test"
storage_account_name = "testaccount"
container_name = "testc"
key = "testc.state"
}
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "2.46.0"
}
}
}
# Configure the Microsoft Azure Provider
provider "azurerm" {
features {}
}
data "azurerm_key_vault" "keyVaultClientID" {
name = "AKSClientID"
key = var.keyvaultID
}
data "azure_key_vault_secret" "keyVaultClientSecret" {
name = "AKSClientSecret"
key_vault_id = var.keyvaultID
}
resource "azurerm_kubernetes_cluster" "test_cluster" {
name = var.name
location = var.location
resource_group_name = var.resourceGroup
dns_prefix = ""
default_node_pool {
name = "default"
node_count = 1
vm_size = "Standard_D2_v2"
}
service_principal {
client_id = data.azurerm_key_vault_secret.keyVaultClientID.value
client_secret = data.azurerm_key_vault_secret.keyVaultClientSecret.value
}
tags = {
"Environment" = "Development"
}
}
我收到的错误消息如下:
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/azure: provider
│ registry registry.terraform.io does not have a provider named
│ registry.terraform.io/hashicorp/azure
我正在查看文档,并且正在更改版本,但我没有得到任何运气。有谁知道我还能做什么或我应该在 main.tf 上更改什么?
要解决此问题,您必须在主地形规划中添加以下内容:
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.75.0"
}
如果你加上它,这个问题就再也不会出现了。此外,您可能必须 运行 升级命令以确保 terraform 能够处理新版本。