From 1325f014de84efe1ccc3653e8d8d63f46a1a3113 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 15:35:23 -0700 Subject: [PATCH] Update terraform-apply.yml --- .github/workflows/terraform-apply.yml | 46 ++++++++++++++++++++------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/.github/workflows/terraform-apply.yml b/.github/workflows/terraform-apply.yml index 8615845..052d8d8 100644 --- a/.github/workflows/terraform-apply.yml +++ b/.github/workflows/terraform-apply.yml @@ -15,22 +15,46 @@ jobs: # This workflow contains a single job called "build" build: # The type of runner that the job will run on - runs-on: [ image-pipeline ] + runs-on: [ aws-image-pipeline ] + env: + AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" + AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}" + AWS_SESSION_TOKEN: "${{ secrets.AWS_SESSION_TOKEN }}" + # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 - - uses: hashicorp/setup-terraform@v3 - with: - terraform_wrapper: false - # Runs a set of commands using the runners shell - - name: Run a multi-line script + - uses: CSVD/gh-actions-setup-node@v3 + with: + node-version: 16 + +# - uses: CSVD/gh-actions-setup-terraform@v2 +# with: +# terraform_wrapper: false + + - name: Terraform Format + id: fmt run: | - terraform init -upgrade - terraform apply -auto-approve - env: - AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_ACCESS_KEY_ID=${{ vars.AWS_ACCESS_KEY_ID }} + terraform fmt -check + + - name: Autoformat Halt + if: env.auto_format == 'true' + run: exit 1 + + - name: Terraform Init + id: init + run: terraform init -upgrade + + - name: Terraform Validate + id: validate + run: terraform validate + + - name: Terraform Plan + id: apply + run: terraform apply -auto-approve + continue-on-error: true +