【Terraform】Terraform ~ 入門編 ~

■ はじめに

Terraform (テラフォーム)について、学ぶ。

目次

【1】Terraform
【2】設定手順
 1)環境
 2)手順

【1】Terraform

* Vagrant を開発しているHashiCorp社が提供する
 インフラ構成管理ツール

その他の基本事項

* 定義ファイル(拡張子 .tf)に設定内容を記述

【2】設定手順

1)環境

* OS:Windows10
* Terraform:v 0.12.17

2)手順

[1] 以下からモジュールをダウンロードする
 => 今回の場合、「terraform_0.12.17_windows_amd64.zip」

https://www.terraform.io/downloads.html

[2] 解凍して、任意の場所にExeを置く
 => 今回の場合、「C:\work\terraform\terraform.exe」

[3] 環境変数「PATH」に追加
 => 今回の場合、「C:\work\terraform」

[4] 確認のために、コマンドプロンプトを立ち上げて「terraform -help」を入力する
~~~~~
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
    import             Import existing infrastructure into Terraform
    init               Initialize a Terraform working directory
    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
    debug              Debug output management (experimental)
    force-unlock       Manually unlock the terraform state
    push               Obsolete command for Terraform Enterprise legacy (v1)
    state              Advanced state management
~~~~~

参考文献

https://qiita.com/Chanmoro/items/55bf0da3aaf37dc26f73
https://dev.classmethod.jp/cloud/aws/my-first-step-of-terraform/
https://qiita.com/kenkono/items/2fb65e7326f957315362
Windows
https://qiita.com/miwato/items/b7e66cb087666c3f9583
https://sacloud.github.io/terraform-provider-sakuracloud/installation/