LoginSignup
1
0

More than 3 years have passed since last update.

Terraform init で Registry service unreachable. とエラーが出た場合の対処法

Last updated at Posted at 2019-09-26

環境

Terraform 0.12.9
MacOS Mojave 10.14.6

エラー

terraform init をすると、こんなエラーが表示されました。

terminal
$ terraform init

Initializing the backend...

Initializing provider plugins...
- Checking for available provider plugins...

Registry service unreachable.

This may indicate a network issue, or an issue with the requested Terraform Registry.


Error: registry service is unreachable, check https://status.hashicorp.com/ for status updates

どうやったら解決出来るだろうか?

バージョンを変えれば解決するのではと思い、tfenvを使ってバージョンを 0.12.9 -> 0.11.14 にダウングレードして再びterraform initした所、次はこんなエラーが、、、

terminal
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/: dial tcp: i/o timeout.

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/darwin_amd64

最後の文によると、どうやらプラグインを手動でダウンロードすれば良さそうです。

さらにこのサイト(Terraform Provider がないエラー対処 | infraya.work)を見ると、https://releases.hashicorp.com/からプラグインをダウンロード出来るみたいです。

解消方法

ということで、https://releases.hashicorp.com/から該当するプラグインのzipファイルをダウンロードして解凍し、出てきた実行ファイルを/Users/ユーザー名/.terraform.d/plugins/に置いた所、エラーが解消されました。

terminal
$ terraform init

Initializing the backend...

Initializing provider plugins...

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.

追記

僕の場合はawsのプラグインが足りないみたいだったので、これをダウンロードしました。
@2019/9/26

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0