Terraform init実行時にプラグインエラーが発生した場合の対処方法

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 
このケースは限定的な環境でしか起こらないと思いますが、もし誰かのお役に立てれば光栄です。

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)