尝试让 Terraform 下载 AWS 插件,但运行时
terraform init
我只得到以下内容
Initializing the backend...
Initializing provider plugins...
Terraform has been successfully initialized!
没有迹象表明提供商插件已安装。我已经使用 VSCode 在 Windows 11 和 Ubuntu Linux 上尝试过此操作
在 main.tf 文件中运行
terraform init
。
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = "us-east-1"
}
运行
terraform provider
显示未安装任何内容。在当前工作目录中没有看到任何隐藏的 .terraform
配置文件。
更新 兰
TF_LOG=DEBUG terraform init
2024-12-17T14:43:54.616-0600 [INFO] Terraform version: 1.10.1
2024-12-17T14:43:54.616-0600 [DEBUG] using github.com/hashicorp/go-tfe v1.70.0
2024-12-17T14:43:54.616-0600 [DEBUG] using github.com/hashicorp/hcl/v2 v2.23.0
2024-12-17T14:43:54.616-0600 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2024-12-17T14:43:54.616-0600 [DEBUG] using github.com/zclconf/go-cty v1.15.1-0.20241111215639-63279be090d7
2024-12-17T14:43:54.616-0600 [INFO] Go runtime version: go1.23.3
2024-12-17T14:43:54.616-0600 [INFO] CLI args: []string{"terraform", "init"}
2024-12-17T14:43:54.617-0600 [DEBUG] Attempting to open CLI config file: /home/cody/.terraformrc
2024-12-17T14:43:54.617-0600 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2024-12-17T14:43:54.617-0600 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2024-12-17T14:43:54.617-0600 [DEBUG] ignoring non-existing provider search directory /home/cody/.terraform.d/plugins
2024-12-17T14:43:54.617-0600 [DEBUG] ignoring non-existing provider search directory /home/cody/.local/share/terraform/plugins
2024-12-17T14:43:54.617-0600 [DEBUG] ignoring non-existing provider search directory /usr/share/ubuntu/terraform/plugins
2024-12-17T14:43:54.617-0600 [DEBUG] ignoring non-existing provider search directory /usr/share/gnome/terraform/plugins
2024-12-17T14:43:54.617-0600 [DEBUG] ignoring non-existing provider search directory /home/cody/.local/share/flatpak/exports/share/terraform/plugins
2024-12-17T14:43:54.617-0600 [DEBUG] ignoring non-existing provider search directory /var/lib/flatpak/exports/share/terraform/plugins
2024-12-17T14:43:54.617-0600 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins
2024-12-17T14:43:54.617-0600 [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins
2024-12-17T14:43:54.617-0600 [DEBUG] ignoring non-existing provider search directory /var/lib/snapd/desktop/terraform/plugins
2024-12-17T14:43:54.617-0600 [INFO] CLI command args: []string{"init"}
Initializing the backend...
2024-12-17T14:43:54.617-0600 [DEBUG] checking for provisioner in "."
2024-12-17T14:43:54.617-0600 [DEBUG] checking for provisioner in "/usr/local/bin"
Initializing provider plugins...
该问题似乎是由文件权限和文件所有权引起的。 VScode 工作区文件夹最初是在 Ubuntu Documents 文件夹中创建的。在主空间中创建一个单独的文件夹解决了这个问题