serverapps:configmgmt:terraform
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
serverapps:configmgmt:terraform [2018/10/30 02:47] – [参照元] hayashi | serverapps:configmgmt:terraform [2024/01/19 07:19] (現在) – hayashi | ||
---|---|---|---|
行 2: | 行 2: | ||
hashi corp製。\\ | hashi corp製。\\ | ||
infraに特化 | infraに特化 | ||
+ | |||
+ | ===== install ===== | ||
+ | ==== Ubuntu ==== | ||
+ | < | ||
+ | wget -O- https:// | ||
+ | echo "deb [signed-by=/ | ||
+ | sudo apt update && sudo apt install terraform | ||
+ | </ | ||
+ | |||
===== 異なるtfstateファイルのリソースを参照する ===== | ===== 異なるtfstateファイルのリソースを参照する ===== | ||
行 8: | 行 17: | ||
* 今回の例ではtfstateはS3にあるものとする | * 今回の例ではtfstateはS3にあるものとする | ||
+ | < | ||
+ | output " | ||
+ | value = " | ||
+ | } | ||
+ | </ | ||
==== リソース情報を参照 ==== | ==== リソース情報を参照 ==== | ||
+ | 参照用データソース作成 | ||
< | < | ||
data " | data " | ||
行 20: | 行 35: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | 参照する | ||
+ | |||
+ | < | ||
+ | resource " | ||
+ | instance_id | ||
+ | } | ||
+ | </ | ||
+ | ===== 特定のリソースのみを対象とする ===== | ||
+ | |||
+ | $ terraform {plan|apply|destroy} -target={resource name} | ||
+ | |||
+ | |||
+ | ===== 特定のアウトプットをコマンドで取得する ===== | ||
+ | |||
+ | $ terraform output outputvalue | ||
+ | |||
+ | ===== terraformで自動で読込まれるVariableファイル ===== | ||
+ | |||
+ | カレントディレクトリの terraform.tfvars ファイルと *.auto.tfvars というsuffixのファイルが自動的に読み込まれる。 |
serverapps/configmgmt/terraform.1540867629.txt.gz · 最終更新: 2018/10/30 02:47 by hayashi