Merge pull request #38 from Shion1305/shion/remove-unused-secret #10
This file contains 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 Apply for Artifact Registry | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/deploy-terraform-apply.yaml' | |
- 'terraform/**' | |
jobs: | |
run-terraform-apply: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
pull-requests: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup aqua | |
uses: aquaproj/aqua-installer@v2.3.0 | |
with: | |
aqua_version: v2.25.1 | |
- name: Login to Google Cloud | |
id: auth | |
uses: google-github-actions/auth@v2 | |
with: | |
token_format: access_token | |
workload_identity_provider: 'projects/938038185918/locations/global/workloadIdentityPools/default/providers/provider-github' | |
service_account: 'gh-actions@lumos-profile-management.iam.gserviceaccount.com' | |
- name: Terraform Init | |
run: terraform init | |
working-directory: terraform | |
- name: TFlint | |
working-directory: terraform | |
env: | |
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
tflint --config .tflint.hcl --init | |
tflint --config .tflint.hcl --format=checkstyle | \ | |
reviewdog -f=checkstyle \ | |
-name="tflint" \ | |
-reporter=github-pr-review \ | |
-filter-mode=nofilter \ | |
-fail-on-error | |
- name: Check terraform fmt | |
working-directory: terraform | |
run: terraform fmt -check | |
- name: Terraform validate | |
working-directory: terraform | |
run: terraform validate | |
- name: Terraform apply | |
working-directory: terraform | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: tfcmt apply -- terraform apply -auto-approve |