Skip to content

Updated template (#4) #6

Updated template (#4)

Updated template (#4) #6

name: Deploy to AWS
on:
push:
paths:
- "cloud/**"
permissions:
id-token: write
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
accounts: ${{ steps.changes.outputs.all_changed_files }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: tj-actions/changed-files@v41
id: changes
with:
path: cloud
dir_names: "true"
dir_names_max_depth: 1
json: true
quotepath: false
escape_json: false
RunApply:
runs-on: ubuntu-latest
needs: changes
strategy:
matrix:
account: ${{ fromJSON(needs.changes.outputs.accounts) }}
continue-on-error: true
container: blackbirdcloud/terraform-toolkit:0.0.8
steps:
- name: Git clone the repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: change --global to --system
run: git config --global --add safe.directory /__w/YOURPROJECTNAME/YOURPROJECTNAME
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_IAM_ROLE }}
role-session-name: github-action
aws-region: ${{ vars.AWS_REGION }}
- name: apply
working-directory: ./cloud/${{ matrix.account }}
run: terragrunt run-all apply --terragrunt-fetch-dependency-output-from-state --terragrunt-non-interactive --terragrunt-ignore-external-dependencies --terragrunt-download-dir=../../.terragrunt-cache