Update iam.tf #34
Workflow file for this run
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 plan | |
| on: | |
| pull_request: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| get_changed_dirs: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| dirs: ${{ steps.get_dirs.outputs.changed_dirs }} | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get list of changed directories | |
| id: get_dirs | |
| shell: bash | |
| run: | | |
| changed_dirs=$(git diff --name-only origin/main...HEAD | \ | |
| grep '/' | \ | |
| grep '\.tf$' | \ | |
| xargs -n 1 dirname | \ | |
| sort -u | \ | |
| jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| if [ -z "$changed_dirs" ]; then | |
| changed_dirs='[]' | |
| fi | |
| echo "changed_dirs=$changed_dirs" >> $GITHUB_OUTPUT | |
| plan: | |
| if: ${{ needs.get_changed_dirs.outputs.dirs != '[]' }} | |
| runs-on: ubuntu-latest | |
| needs: get_changed_dirs | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| dir: ${{ fromJson(needs.get_changed_dirs.outputs.dirs) }} | |
| defaults: | |
| run: | |
| shell: bash | |
| working-directory: ${{ matrix.dir }} | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@v4 | |
| - name: Setup AWS Credentials | |
| uses: ./.github/actions/configure_aws_credentials | |
| id: configure-aws-credentials | |
| with: | |
| aws-role-arn: ${{ secrets.AWS_ROLE_ARN }} | |
| - name: Setup tfcmt | |
| uses: shmokmt/actions-setup-tfcmt@v2 | |
| with: | |
| version: v4.6.0 | |
| - name: Get Terraform version | |
| id: terraform-version | |
| uses: bigwheel/[email protected] | |
| with: | |
| path: ${{ matrix.dir }} | |
| - name: SetUp Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: ${{ steps.terraform-version.outputs.terraform_version }} | |
| - name: Terraform init | |
| run: terraform init | |
| - name: Terraform plan | |
| run: | | |
| tfcmt plan -patch -- terraform plan -no-color -input=false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |