0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

概要

Terraform初学者向け

Terafformとは

インフラストラクチャをコードとして定義し、任意のクラウドやオンプレミスのリソースを自動的にプロビジョニング、管理するためのツール。
これにより、インフラの設定が一貫性を持って再現可能になり、手動設定のミスを防ぐことができる。

複数のクラウドサービスに対応しており、オンプレミス環境にも対応している。

関連リンク

環境構築

1. AWS CLIインストール

Macの場合

インストールコマンド
brew install awscli
バージョン確認
aws --version

2. Terraform用IAMユーザー作成

  • AWSコンソール上にIAMユーザーを作成する

「アクセスキー」「シークレットアクセスキー」をメモしておく

3. awsの初期設定

ターミナルでAWSの「アクセスキー」「シークレットアクセスキー」「リージョン名」「アウトプット」を入力する

aws configure
AWS Access Key ID [None]: xxxxxxxxxxxxxxxxxxxx
AWS Secret Access Key [None]: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Default region name [None]: ap-northeast-1
Default output format [None]: json

4. ユーザー「terraform」作成

  • AWSコンソール上にIAMユーザーを作成する

「アクセスキー」「シークレットアクセスキー」をメモしておく

5. ユーザー「terraform」のaws初期設定

ターミナルでAWSの「アクセスキー」「シークレットアクセスキー」「リージョン名」「アウトプット」を入力する

aws configure --profile terraform
AWS Access Key ID [None]: xxxxxxxxxxxxxxxxxxxx
AWS Secret Access Key [None]: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Default region name [None]: ap-northeast-1
Default output format [None]: json

6. Terraformインストール

Macの場合

6-1. tfenvインストール

インストールコマンド
brew install tfenv
インストール可能なバージョン確認
tfenv list-remote
バージョンを指定してterraformをインストールする*バージョンは任意
tfenv install 1.8.3
ローカルで利用するバージョンを指定

7. get-secretsインストール

インストール(Mac)

brew install git-secrets

git-secrets初期化

git secrets --register-aws --global
git secrets --install ~/.git-templates/git-secrets -f
git config --global init.templatedir ~/.git-templates/git-secrets
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?