Tutorial:Terraform Cloud
https://gyazo.com/29d9e6188c2ad61fc87cc9e14a2e2ea3
Step 1
GitHubのように個人ごとにアカウント作成する。(hiroqn.iconこの設計は特性を考えた時に失敗のように感じる)
Self-Hosted プランじゃないとSAMLが使えない。
Step 2
Organizationを作る場合は
招待される場合は待つ
Step 3
Workspaceを作成する。
https://gyazo.com/d8fc243732bffedc38e04b14bde097d5
Step 4
Codeを足す
code:main.tf
terraform {
backend "remote" {
organization = "hogehoge"
workspaces {
name = "hogehoge"
}
}
}
Step 5
https://gyazo.com/7b0b7f213fb57a1a7e1a4a0a549f6fa5
名前をつけてTokenを発行する。関わっているOrganizationごとに発行すると良さそう。
code:credentials.hcl
credentials "app.terraform.io" {
token = "xxxxxxx"
}
をどこかに保存して、実行時の環境変数にそのファイルへのPathを保存する
export TF_CLI_CONFIG_FILE=/credentials.hcl
Option
Execution Mode
Remote
Your plans and applies occur on Terraform Cloud's infrastructure. You and your team have the ability to review and collaborate on runs within the app.
Terraform Cloudで実行される。認証情報などを設定しておく必要がある
Manual実行・Auto実行が選べてCI/CDが可能。
Local
Your plans and applies occur on machines you control. Terraform Cloud is only used to store and synchronize state.
Lockをかけながら手元で実行される。Stateは自動的に更新される。既存のBackendとだいたい一緒