ヘルパースクリプトはhelpers/ディレクトリに配置する
ルール
Save helper scripts in helpers/ directory. Basically place directly under repository root directory, but can be placed under specific module if limited to that module
(ヘルパースクリプトはhelpers/ディレクトリに保存する。基本的にリポジトリルート直下に配置するが、特定モジュール専用の場合はそのモジュール配下に配置できる)
解説
ヘルパースクリプトとは、terraformから呼び出さない、インフラ構築・運用の支援用スクリプトです。テストコマンドをまとめたスクリプトなどが該当します。
スクリプトファイルはscripts/に置きたくなりますが、Terraformでscripts/はカスタムスクリプトと呼ばれるTerraformから呼び出すためのスクリプトを置くための場所として使うことになっています。そのため混同しないよう、Terraformから呼び出さないスクリプトはhelpers/に配置します。
サンプルコード
# プロジェクト全体で使用するヘルパースクリプト
# ディレクトリ構造:
# ./helpers/
# check_state.sh # 全モジュールの状態確認
# generate_docs.sh # ドキュメント生成
#
# 特定モジュール専用のヘルパースクリプト
# ./modules/database/helpers/
# test_connection.sh # このモジュールのDB接続テスト
# backup_verification.sh # このモジュールのバックアップ検証
参考リンク
Show Text to Shareヘルパースクリプトはhelpers/ディレクトリに配置する https://www.tricrow.com/infrastructure/development-guidline/repository_structure.standard.helper_script.html

