diff --git a/.github/workflows/deploy_to_gcp.yml b/.github/workflows/deploy_to_gcp.yml index e04d516..04fc377 100644 --- a/.github/workflows/deploy_to_gcp.yml +++ b/.github/workflows/deploy_to_gcp.yml @@ -14,6 +14,7 @@ jobs: env: GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} + REPO_NAME: ${{ github.repository }} steps: - name: Checkout code uses: actions/checkout@v3 @@ -38,6 +39,10 @@ jobs: gcloud config list gcloud --version + - name: Exec Terraform init shell + run: | + ./scripts/terraform/init.sh + diff --git a/scripts/deploy/init_terraform.sh b/scripts/deploy/init_terraform.sh index 7e57d64..94e1a39 100644 --- a/scripts/deploy/init_terraform.sh +++ b/scripts/deploy/init_terraform.sh @@ -6,13 +6,16 @@ set -euo pipefail TF_DIR=${TF_DIR:-terraform} # GCS S3などで保存する -TF_STATE_BUCKET=${TF_STATE_BUCKET:-cicd-tfstate-bucket} +TF_STATE_BUCKET=${TF_STATE_BUCKET:-cicd-tfstate-bucket-20250906} ENV=${ENV:-dev} REPO_NAME=${REPO_NAME:-unknown} cd "$TF_DIR" +echo "$REPO_NAME" -# --- terraform init 実行 --- +ecgi + +# # --- terraform init 実行 --- terraform init \ -backend-config="bucket=${TF_STATE_BUCKET}" \ -backend-config="prefix=${REPO_NAME}/${ENV}" \