如果在执行Terraform init时出现插件错误,处理方法如下:

关于结构

    • OS: Amazon Linux 2 AMI (HVM), SSD Volume Type – ami-0a2de1c3b415889d2

 

    Terraform: v0.11.11

执行Terraform init时出现错误。

如果在执行terraform init时发生以下错误,则表示无法下载提供程序插件。

$ terraform init -upgrade

Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...

Error installing provider "aws": Get https://releases.hashicorp.com/terraform-provider-aws/: proxyconnect tcp: tls: oversized record received with length 20527.

Terraform analyses the configuration and state and automatically downloads
plugins for the providers used. However, when attempting to download this
plugin an unexpected error occured.

This may be caused if for some reason Terraform is unable to reach the
plugin repository. The repository may be unreachable if access is blocked
by a firewall.

If automatic installation is not possible or desirable in your environment,
you may alternatively manually install plugins by downloading a suitable
distribution package and placing the plugin's executable file in the
following directory:
    terraform.d/plugins/linux_amd64

您可以通过手动放置插件来避免这个问题。因此,请在执行terraform的目录下创建以下目录并放置文件。

$ mkdir -p terraform.d/plugins/linux_amd64
$ cd terraform.d/plugins/linux_amd64/
$ wget https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip
$ unzip terraform_0.11.11_linux_amd64.zip

重新运行 Terraform init,并确认没有问题。

$ terraform init -upgrade

我认为这种情况只会在特定的环境下发生,但如果能对某人有所帮助,那将感到荣幸。

bannerAds