fix: argocd로 이전 #32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Terraform | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
terraform: | |
name: "Terraform Apply" | |
runs-on: ubuntu-latest | |
steps: | |
# 현재 repository를 체크아웃 | |
- name: Checkout repository | |
uses: actions/[email protected] | |
# tfvars 파일이 있는 다른 repository를 체크아웃 | |
- name: Checkout tfvars repository | |
uses: actions/[email protected] | |
with: | |
repository: code-review-platform-flow/flow-terraform-tfvars | |
path: tfvars-repo | |
token: ${{ secrets.TOKEN }} | |
# Terraform 설정 | |
- name: Set up Terraform | |
uses: hashicorp/[email protected] | |
with: | |
terraform_version: 1.9.2 | |
# GCP 인증 | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/[email protected] | |
with: | |
credentials_json: "${{ secrets.GCP_CREDENTIALS }}" | |
# Google Cloud SDK 설정 | |
- name: Set up Google Cloud SDK | |
uses: google-github-actions/[email protected] | |
with: | |
version: "latest" | |
project_id: "code-review-platform-flow" | |
# tfvars 파일 복사 | |
- name: Copy tfvars file | |
run: cp tfvars-repo/terraform.tfvars ./terraform.tfvars | |
# Terraform Init | |
- name: Terraform Init | |
run: terraform init | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
# Terraform Plan | |
- name: Terraform Plan | |
run: terraform plan -var-file=terraform.tfvars | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
# Terraform Apply | |
- name: Terraform Apply | |
if: github.ref == 'refs/heads/main' | |
run: terraform apply -auto-approve -var-file=terraform.tfvars | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} |