From 1cabac64754821f85b6572935ef8ce351afe6351 Mon Sep 17 00:00:00 2001 From: Hector Machin Date: Sat, 5 Oct 2024 10:32:32 -0400 Subject: [PATCH 1/2] Fixing badges and github workflows --- .github/workflows/deploy-dev.yml | 7 ++----- .../workflows/{validate.yml => validate-plan.yml} | 14 +++++++++++++- README.md | 4 ++-- 3 files changed, 17 insertions(+), 8 deletions(-) rename .github/workflows/{validate.yml => validate-plan.yml} (85%) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index c2bc945..25bc745 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -98,13 +98,11 @@ jobs: - name: Terraform Apply id: tf_apply - continue-on-error: true run: terraform apply -lock=false -input=false ${{ env.stage }}.tfplan - name: Post status to Slack channel id: tf_apply_successs - if: steps.tf_apply.outcome == 'success' - continue-on-error: true + if: always() && steps.tf_apply.outcome == 'success' uses: slackapi/slack-github-action@v1.26.0 with: channel-id: ${{ secrets.SLACK_CHANNEL_ID }} @@ -114,8 +112,7 @@ jobs: - name: Post status to Slack channel id: tf_apply_failure - if: steps.tf_apply.outcome != 'success' - continue-on-error: true + if: always() && steps.tf_apply.outcome != 'success' uses: slackapi/slack-github-action@v1.26.0 with: channel-id: ${{ secrets.SLACK_CHANNEL_ID }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate-plan.yml similarity index 85% rename from .github/workflows/validate.yml rename to .github/workflows/validate-plan.yml index a51f432..c506e8e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate-plan.yml @@ -1,4 +1,4 @@ -name: 📝 Validation +name: 📝 Validate & Plan on: push: @@ -92,3 +92,15 @@ jobs: - name: Terraform Validate id: tf_validate run: terraform validate -no-color + + - name: Configure Terraform Plan Credentials + id: plan_creds + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-region: ${{ secrets.AWS_REGION }} + role-to-assume: ${{ secrets.AWS_ROLE }} + role-session-name: GooseTFPlan + + - name: Terraform Plan + id: tf_plan + run: terraform plan -var-file="${{ env.stage }}.tfvars" -out ${{ env.stage }}.tfplan -lock=false diff --git a/README.md b/README.md index a171b3a..3f7150b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@

- Deploy Status + Deploy Status - Scan Status + Scan Status License From 2bf719309d476d5a4ef4e78521b0e39dfac9fda2 Mon Sep 17 00:00:00 2001 From: Hector Machin Date: Sat, 5 Oct 2024 10:34:28 -0400 Subject: [PATCH 2/2] Fixing badges and github workflows --- .github/workflows/validate-plan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-plan.yml b/.github/workflows/validate-plan.yml index c506e8e..fb08285 100644 --- a/.github/workflows/validate-plan.yml +++ b/.github/workflows/validate-plan.yml @@ -12,7 +12,7 @@ permissions: contents: read jobs: - validate: + validate-and-plan: permissions: id-token: write contents: read