File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,41 +17,23 @@ jobs:
1717 name : Terraform
1818 runs-on : ubuntu-latest
1919
20- env :
21- GCP_SA_KEY : ${{ secrets.GCP_SA_KEY }}
22-
2320 steps :
2421 - name : Checkout code
2522 uses : actions/checkout@v6
26- with :
27- persist-credentials : false
2823
2924 - name : Authenticate with Google Cloud
3025 uses : google-github-actions/auth@v3
3126 with :
32- project_id : " httparchive"
33- credentials_json : ${{ env .GCP_SA_KEY }}
27+ project_id : ' httparchive'
28+ credentials_json : ${{ secrets .GCP_SA_KEY }}
3429
3530 - name : Set up Terraform
36- uses : hashicorp/setup-terraform@v3.1.2
37-
38- - name : Terraform Format Check
39- working-directory : ./infra
40- run : terraform fmt -check
31+ uses : hashicorp/setup-terraform@v3
4132
4233 - name : Initialize Terraform
43- working-directory : ./infra
44- run : terraform init
45-
46- - name : Validate Terraform
47- working-directory : ./infra
48- run : terraform validate
49-
50- - name : Plan Terraform
51- working-directory : ./infra
52- run : terraform plan -out=tfplan
34+ run : |
35+ make tf_init
36+ make tf_lint
5337
5438 - name : Apply Terraform
55- if : github.ref == 'refs/heads/main' && github.event_name == 'push'
56- working-directory : ./infra
57- run : terraform apply -auto-approve tfplan
39+ run : make tf_apply
Original file line number Diff line number Diff line change 22 rm -rf ./infra/bigquery-export/node_modules
33 rm -rf ./infra/dataform-service/node_modules
44
5+ tf_init :
6+ cd infra && terraform init -upgrade
7+
8+ tf_lint :
9+ cd infra && terraform fmt -check && terraform validate
10+
511tf_plan :
6- cd infra && terraform init -upgrade && terraform plan
12+ cd infra && terraform plan
713
814tf_apply :
9- cd infra && terraform init && terraform apply -auto-approve
15+ cd infra && terraform apply -auto-approve
You can’t perform that action at this time.
0 commit comments