インストール
macOS (Homebrewを使う場合)
brew install terraformバージョンの確認
terraform versionTerraform v0.11.13
初期化
terraform init を使って初期化します。
terraform init[0m[1mTerraform initialized in an empty directory![0m The directory has no Terraform configuration files. You may begin working with Terraform immediately by creating Terraform configuration files.[0m
planを実行
terraform plan[0m[1mRefreshing Terraform state in-memory prior to plan...[0m The refreshed state will be used to calculate this plan, but will not be persisted to local or remote state storage. [0m ------------------------------------------------------------------------ [0m[1m[32mNo changes. Infrastructure is up-to-date.[0m[32m This means that Terraform did not detect any differences between your configuration and real physical resources that exist. As a result, no actions need to be performed.[0m
適応する
applyコマンドを使って
terraform apply -input=false[0m[1m[32m Apply complete! Resources: 0 added, 0 changed, 0 destroyed.[0m
tfstateファイルができる
terraformはリソースの状態を terraform.tfstate というファイルの中に記述することで管理をしています。
中身はこのようなjsonファイルです。
{
"version": 3,
"terraform_version": "0.11.13",
"serial": 1,
"lineage": "4c522adb-b827-5753-c96b-6cc88a640a13",
"modules": [
{
"path": [
"root"
],
"outputs": {},
"resources": {},
"depends_on": []
}
]
}