質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Terraform

Terraformは、インフラ構築のためのツールです。AWS/DigitalOcean/GoogleCloudといった様々なインフラに対応。インフラ構成のコード管理や変更の作業などの手間を自動化し、インフラ構築の効率化を図ることができます。

Q&A

解決済

1回答

3079閲覧

【terraform】インストールできません

narururu

総合スコア172

Terraform

Terraformは、インフラ構築のためのツールです。AWS/DigitalOcean/GoogleCloudといった様々なインフラに対応。インフラ構成のコード管理や変更の作業などの手間を自動化し、インフラ構築の効率化を図ることができます。

0グッド

0クリップ

投稿2020/11/09 10:08

編集2020/11/09 10:31

解決したい課題

terraformをインストールしたい

環境

windows10
64bit
powershell

現状

Usage: terraform [-version] [-help] <command> [args] The available commands for execution are listed below. The most common, useful commands are shown first, followed by less common or more advanced commands. If you're just getting started with Terraform, stick with the common commands. For the other commands, please read the help and docs before usage. Common commands: apply Builds or changes infrastructure console Interactive console for Terraform interpolations destroy Destroy Terraform-managed infrastructure env Workspace management fmt Rewrites config files to canonical format get Download and install modules for the configuration graph Create a visual graph of Terraform resources init Initialize a Terraform working directory login Obtain and save credentials for a remote host logout Remove locally-stored credentials for a remote host output Read an output from a state file plan Generate and show an execution plan providers Prints a tree of the providers used in the configuration refresh Update local state file against real resources show Inspect Terraform state or plan taint Manually mark a resource for recreation untaint Manually unmark a resource as tainted validate Validates the Terraform files version Prints the Terraform version workspace Workspace management All other commands: 0.12upgrade Rewrites pre-0.12 module source code for v0.12 0.13upgrade Rewrites pre-0.13 module source code for v0.13 debug Debug output management (experimental) force-unlock Manually unlock the terraform state push Obsolete command for Terraform Enterprise legacy (v1) state Advanced state management

試したこと

①本家Terraformサイトからwindows版64-bitのterraformファイルをダウンロード。
https://www.terraform.io/downloads.html

②ルート配下にterraformフォルダを作成し解凍したterraformファイルを移動。

③環境変数のPathの項目にに下記を追記。
C:\terraform

④VSを開いてterminalを開いて下記コマンドを実行。

PS C:\terraform> terraform

⑤下記エラーが表示される。

PS C:\terraform> terraform terraform : 用語 'terraform' は、コマンドレット、関数、スクリプト ファイル、または操作可能なプログラムの名前として認識されません。名前が正しく記述され ていることを確認し、パスが含まれている場合はそのパスが正しいことを確認してから、再試行してください。 発生場所 行:1 文字:1 + terraform + ~~~~~~~~~ + CategoryInfo : ObjectNotFound: (terraform:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException Suggestion [3,General]: コマンド terraform は見つかりませんでしたが、現在の場所に存在します。Windows PowerShell は、既定では、現在の場所からコマンドを読 み込みません。このコマンドを信頼する場合は、".\terraform" と入力してください。詳細については、"get-help about_Command_Precedence" と入力してヘルプを参照 してください。

⑥下記コマンドを実行

PS C:\terraform> .\terraform

⑦エラーが表示される。
※現状を参照

エラーの原因が分かりません。。。
どなたか教えていただけませんでしょうか。

##追記

PS C:\terraform> get-help about_Command_Precedence get-help : Get-Help を実行しましたが、このセッションではヘルプ ファイルの about_Command_Precedence が見つかりませんでした。更新されたヘルプ トピックを ダウンロードするには、「Update-Help」と入力してください。ヘルプをオンラインで参照するには、TechNet ライブラリ (https://go.microsoft.com/fwlink/?LinkID= 107116) でヘルプ トピックを検索してください。 発生場所 行:1 文字:1 + get-help about_Command_Precedence + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

その実行ファイルがない、と言うエラーです。
そこでdir とコマンド入れたら、terraform.exe というファイルが見えるでしょうか

投稿2020/11/09 10:20

y_waiwai

総合スコア87774

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

narururu

2020/11/09 10:23

ご回答ありがとうございます。y_waiwaiさん☺ はい。terraform.exe というファイルは見えております。 PS C:\terraform> dir ディレクトリ: C:\terraform Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 2020/11/09 18:52 85505864 terraform.exe
y_waiwai

2020/11/09 10:28

ああ、PowerShellでしたか。 PowerShellで実行する場合は、 ./terraform と入力してください
y_waiwai

2020/11/09 10:30

ちなみに、コマンドプロンプト上であれば、 terraform で実行できます
narururu

2020/11/09 10:30

はい。powershellを使用しています。 ./terraformを入力後、「現状」で記載した内容と同じエラーが表示されてしまいます。
y_waiwai

2020/11/09 10:32

なら、cmdと入れてコマンドプロンプトを起動させてやってみてください
narururu

2020/11/09 10:33

コマンドプロンプトでも下記を試してみましたが、同様のエラーが表示されてしまいます。 C:\terraform>terraform
y_waiwai

2020/11/09 10:33

ああ、現状で記載されてるのはエラーでなくてきちんと実行されてるってことですね 引数がないのでヘルプがでている状態です
narururu

2020/11/09 10:37

コマンドプロンプトで下記コマンドを実行したらバージョンが確認できました。正常にインストールできているということでしょうか。 C:\terraform>terraform version Terraform v0.13.5 一方で、powershellで同様のコマンドを実行してもバージョンは表示されず⑤で記載したエラーが表示されてしまいます。 powershellではterraformは使用できないんですね。
narururu

2020/11/09 10:46

powershellよくわからんです。 でも、コマンドプロンプトで動かせることがわかってよかたです。 アドバイスありがとうございました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問