AWS CLI,Terraform初期設定を完了 #9
対応内容
以下の4ファイルを追加。
- tfstate
- terraform.tfvars
- README.md
- provider.tf
チケット
イシュー
確認内容
-
README.md
の記載に誤りはないかを確認した。 -
以下のコマンドを実施した上で、 terraform apply
が問題なく動作するかの確認を実施済み。
$ terraform apply
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against
your configuration and found no differences, so no changes
are needed.
Apply complete! Resources: 0 added, 0 changed, 0 destroyed
# 1. IAMアカウントの作成とCredential情報の追加
- IAMアカウントを作成する。
- IAM Management Consoleを開く。
- アクセスキーを発行する。
- 取得されるアクセスキー(access_key)とシークレットキー(secret_key)を控える。
# 2. AWS CLIの導入
$ pip3 install awscli --upgrade
# 3. Terraformの導入
$ brew install terraform
$ terraform --version
# 4. バージョンマネージャー「tfenv」の導入
$ brew install tfenv
# 5. リポジトリの取得
$ cd terraform
# 6. terraform.tfvarsの修正
$ touch terraform.tfvars
$ echo 'access_key = "[access_key]"' >> terraform.tfvars
$ echo 'secret_key = "[secret_key]"' >> terraform.tfvars
# 7. Terraformの実行
$ terraform init
Initializing the backend...
Initializing provider plugins...
- Finding hashicorp/aws versions matching "~> 4.38.0"...
- Installing hashicorp/aws v4.38.0...
- Installed hashicorp/aws v4.38.0 (signed by HashiCorp)
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
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.
$ terraform plan
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no
differences, so no changes are needed.
$ terraform apply
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no
differences, so no changes are needed.
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Edited by Lucifer