Merge pull request #43 from mitou/kyasbal-patch-4 #66
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: Apply(IAM mode) | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
apply: | |
permissions: | |
id-token: write | |
pull-requests: write | |
name: Apply | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dir: [ | |
terraform/iam | |
] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Check diff | |
id: diff | |
uses: technote-space/[email protected] | |
with: | |
PATTERNS: | | |
${{ matrix.dir }}/**/*.tf | |
- name: Authenticate to GCP | |
if: env. GIT_DIFF_FILTERED | |
id: gcp_auth | |
uses: google-github-actions/[email protected] | |
with: | |
create_credentials_file: 'true' | |
workload_identity_provider: projects/233207969476/locations/global/workloadIdentityPools/github-action/providers/github-action-provider | |
service_account: [email protected] | |
access_token_lifetime: 1200s | |
- name: gcloud auth login by workload identity | |
if: env. GIT_DIFF_FILTERED | |
run: |- | |
gcloud auth login --brief --cred-file="${{ steps.gcp_auth.outputs.credentials_file_path }}" | |
- name: Setup terraform | |
if: env. GIT_DIFF_FILTERED | |
uses: hashicorp/[email protected] | |
with: | |
terraform_version: 1.0.11 | |
- name: Apply | |
if: env. GIT_DIFF_FILTERED | |
run: | | |
cd ${{ matrix.dir }} | |
terraform init | |
terraform get | |
terraform apply -auto-approve | |
shell: bash |