Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform関連全般バージョンアップ #24

Merged
merged 1 commit into from
May 31, 2024

Conversation

fittecs
Copy link
Member

@fittecs fittecs commented May 31, 2024

概要

表題通り以下の作業を実施。
なおツール類やGHAのactionのバージョンアップは導入からまだ日が浅いため行わない。

作業手順

1. terraformコマンドのバージョンアップ

$ tfenv list-remote
$ tfenv install 1.8.4
$ tfenv use 1.8.4
$ terraform version

2. 各種ファイルに記載されたバージョンをアップ

ファイル 更新対象
.github/action/setup/action.yaml terraform_version
.github/actions/**/*.yaml 各ツールおよびactionのバージョン
.github/workflows/*.yaml 各ツールおよびactionのバージョン
terraform/globals.tf required_version
terraform/globals.tf required_providersの各providerのバージョン
terraform/.tflint.hcl googleプラグインのバージョン
.regal/config.yaml capabilities.from.version
terraform/tier1-main.tf project_servicesモジュールのバージョン
terraform/modules/**/main.tf サードパーティのモジュールのバージョン

バージョンアップしたファイルに関連するツールが正しく動くかを確認するために、scriptsディレクトリ内のシェルを実行して正常系、異常系どちらも反応することを確認。

3. test環境のtier1、tier2ディレクトリ内にある.terraform.lock.hclを更新(しないとCIが落ちる)

$ cd /path/to/infra-testing-google-sample/terraform/environments/test/tier1
$ TF_VAR_service=infra-testing-google-sample \
  TF_VAR_env=test \
  terraform init -upgrade

$ cd ../tier2
$ TF_VAR_service=infra-testing-google-sample \
  TF_VAR_env=test \
  terraform init -upgrade

なお全環境のtier1とtier2をterraform init -upgradeを実行しないとローカルでscripts/tfvalidate.shが動かなくなるので、基本全て更新し直すべき。

TF_VAR_service=infra-testing-google-sample \
TF_VAR_env=$ENV \
terraform init -backend-config="bucket=infra-testing-google-sample-$ENV-terraform" -upgrade

Copy link

Action URL: https://github.com/erueru-tech/infra-testing-google-sample/actions/runs/9314801902

stg$ terraform plan

$\color{green}\textsf{[tier1] No changes. Your infrastructure matches the configuration.}$

$\color{green}\textsf{[tier2] Plan: 6 to add, 0 to change, 0 to destroy.}$

@fittecs fittecs merged commit 117b289 into main May 31, 2024
6 checks passed
@fittecs fittecs deleted the feature/version-upgrade branch May 31, 2024 08:19
Copy link

Action URL: https://github.com/erueru-tech/infra-testing-google-sample/actions/runs/9315155224

stg$ terraform apply -auto-approve

$\color{green}\textsf{[tier1] No changes. Your infrastructure matches the configuration.}$

$\color{green}\textsf{[tier2] Plan: 6 to add, 0 to change, 0 to destroy.}$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant