本文へスキップ
hdknr blog
戻る

Terraform

更新日:

README

設計運用

ファイル内容
main.tfリソースを作成する(moduels, locals, data-sources)
variables.tfmain.tf で使われる変数
outputs.tfmain.tf が作成したリソースの出力
% tree large-terraform 
large-terraform
├── README.md
├── modules
│   └── network
│       ├── main.tf
│       ├── outputs.tf
│       └── variables.tf
├── prod
│   ├── main.tf
│   ├── outputs.tf
│   ├── terraform.tfvars
│   └── variables.tf
└── stage
    ├── main.tf
    ├── outputs.tf
    ├── terraform.tfvars
    └── variables.tf

HCL (HCL is the HashiCorp configuration language.)

コメント:

plan

$ env $(cat .env|xargs) terraform -chdir=prod plan -out=myplan.plan
% unzip -l prod/*.plan
Archive:  prod/myplan.plan
  Length      Date    Time    Name
---------  ---------- -----   ----
     1591  06-13-2021 16:08   tfplan
      119  06-13-2021 16:08   tfstate
      119  06-13-2021 16:08   tfstate-prev
      185  06-13-2021 16:08   tfconfig/m-/main.tf
        0  06-13-2021 16:08   tfconfig/m-/outputs.tf
       89  06-13-2021 16:08   tfconfig/m-/variables.tf
     1017  06-13-2021 16:08   tfconfig/m-s3_web/main.tf
       62  06-13-2021 16:08   tfconfig/m-s3_web/variables.tf
      137  06-13-2021 16:08   tfconfig/modules.json
---------                     -------
     3319                     9 files

plan

$ env $(cat .env|xargs) terraform -chdir=prod apply myplan.plan   


前の記事
AWS: ECS
次の記事
Homebrew Applie Silicon