英文:
Error: Failed to query available provider packages
问题
I'm trying to run AKS using terraform(version: 1.4.6) and when I'm performing "terraform init" getting an issue and below is the screenshot for reference.
if anyone knows Kindly help on this.
Modules: AKS, KeyVault, Service Principal
英文:
i'm trying to run AKS using terraform(version: 1.4.6) and when i'm performing "terraform init" getting an issues and below is the screen shot for ref.
if any one knows Kindly help on this.
Modules: AKS, KeyVault, Service Principal
答案1
得分: 1
You are defining the required_providers
block in a wrong way. This:
terraform {
required_providers {
azuread = "~> 2.9.0"
random = "~> 3.1"
azurerm = "~> 3.0.0"
}
}
has to be re-written. You have to use the proper syntax as defined in the documentation. So this would be something like:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0"
}
azuread = {
source = "hashicorp/azuread"
version = "~> 2.0"
}
}
}
You don't have to define the random
provider like that. Running terraform init
works as expected:
terraform init
Initializing modules...
Initializing the backend...
Initializing provider plugins...
- Finding hashicorp/azuread versions matching "~> 2.0"...
- Finding hashicorp/azurerm versions matching "~> 3.0"...
- Installing hashicorp/azurerm v3.55.0...
- Installed hashicorp/azurerm v3.55.0 (signed by HashiCorp)
- Installing hashicorp/azuread v2.38.0...
- Installed hashicorp/azuread v2.38.0 (signed by HashiCorp)
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
[1]: https://github.com/piyushsachdeva/Terraform_AKS/blob/master/versions.tf
[2]: https://developer.hashicorp.com/terraform/language/providers/requirements#requiring-providers
<details>
<summary>英文:</summary>
You are defining the [`required_providers` block][1] in a wrong way. This:
```hcl
terraform {
required_providers {
azuread = "~> 2.9.0"
random = "~> 3.1"
azurerm = "~> 3.0.0"
}
}
has to be re-written. You have to use the proper syntax as defined in the documentation. So this would be something like:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0"
}
azuread = {
source = "hashicorp/azuread"
version = "~> 2.0"
}
}
}
You don't have to define the random
provider like that. Running terraform init
works as expected:
terraform init
Initializing modules...
Initializing the backend...
Initializing provider plugins...
- Finding hashicorp/azuread versions matching "~> 2.0"...
- Finding hashicorp/azurerm versions matching "~> 3.0"...
- Installing hashicorp/azurerm v3.55.0...
- Installed hashicorp/azurerm v3.55.0 (signed by HashiCorp)
- Installing hashicorp/azuread v2.38.0...
- Installed hashicorp/azuread v2.38.0 (signed by HashiCorp)
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论