From 2c5cfa722714166f1ea8a51efe564fad7d7f2ace Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 15 Aug 2024 15:14:54 -0700 Subject: [PATCH 01/11] Update terraform_plan.yaml --- .github/workflows/terraform_plan.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index e8eb613..bde036d 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -66,16 +66,26 @@ jobs: id: validate run: terraform validate -no-color + - name: Terraform Plan + id: plan + if: github.event_name == 'pull_request' + run: terraform plan -no-color -out=${{ vars.plan_cache }}/${{ github.sha }} + continue-on-error: true + - name: Terraform Plan id: plan run: terraform plan -no-color continue-on-error: true + - name: Terraform Show plan + if: github.event_name == 'pull_request' + run: echo ::set-output name=terraform_plan::$(terraform show ${{ vars.plan_cache }}/${{ github.sha }}) + - name: Post Terraform Plan to PR uses: CSVD/gh-actions-github-script@v6 if: github.event_name == 'pull_request' env: - PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" + PLAN: "terraform\n${{ env.terraform_plan }}" with: github-token: ${{ secrets.GH_TOKEN }} script: | From c7d9b4876454cff0b5038530d8f343a335ae3ea9 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 15 Aug 2024 15:15:59 -0700 Subject: [PATCH 02/11] Update terraform_plan.yaml --- .github/workflows/terraform_plan.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index bde036d..334219c 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -73,7 +73,6 @@ jobs: continue-on-error: true - name: Terraform Plan - id: plan run: terraform plan -no-color continue-on-error: true From 4a823afe72ba4d74faa27bd32337a902b61b79a0 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 15 Aug 2024 15:17:23 -0700 Subject: [PATCH 03/11] Update terraform_plan.yaml --- .github/workflows/terraform_plan.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index 334219c..50b6820 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -73,6 +73,7 @@ jobs: continue-on-error: true - name: Terraform Plan + if: github.event_name != 'pull_request' run: terraform plan -no-color continue-on-error: true From bc33078c03479958b0f1ee231df1b8f6c6950d80 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 15 Aug 2024 15:20:22 -0700 Subject: [PATCH 04/11] Update main.tf --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 9d31c8a..6c72d56 100644 --- a/main.tf +++ b/main.tf @@ -2,7 +2,7 @@ locals { collaborators = { naray007 = "push", morga471 = "push", - lolli001 = "pull", + lolli001 = "push", gomez385 = "push" } pull_request_bypassers = [ From 522055e5556dbefdba92562e8d12a907d5946837 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 15 Aug 2024 15:32:32 -0700 Subject: [PATCH 05/11] Update terraform_plan.yaml --- .github/workflows/terraform_plan.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index 50b6820..f2dcacd 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -79,7 +79,7 @@ jobs: - name: Terraform Show plan if: github.event_name == 'pull_request' - run: echo ::set-output name=terraform_plan::$(terraform show ${{ vars.plan_cache }}/${{ github.sha }}) + run: echo terraform_plan=$(terraform show ${{ vars.plan_cache }}/${{ github.sha }}) >> $GITHUB_ENV - name: Post Terraform Plan to PR uses: CSVD/gh-actions-github-script@v6 From c0d985649e7dd88686ea4a9cc3445574977a1ab0 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 15 Aug 2024 15:35:45 -0700 Subject: [PATCH 06/11] Update main.tf --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 6c72d56..20c7dc1 100644 --- a/main.tf +++ b/main.tf @@ -1,7 +1,7 @@ locals { collaborators = { naray007 = "push", - morga471 = "push", + morga471 = "pull", lolli001 = "push", gomez385 = "push" } From 26b31d76c51f0ae92ee8852988a08b452414668a Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 15 Aug 2024 15:40:19 -0700 Subject: [PATCH 07/11] Update terraform_plan.yaml --- .github/workflows/terraform_plan.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index f2dcacd..256518c 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -69,17 +69,17 @@ jobs: - name: Terraform Plan id: plan if: github.event_name == 'pull_request' - run: terraform plan -no-color -out=${{ vars.plan_cache }}/${{ github.sha }} + run: terraform plan -out=${{ vars.plan_cache }}/${{ github.sha }} continue-on-error: true - name: Terraform Plan if: github.event_name != 'pull_request' - run: terraform plan -no-color + run: terraform plan continue-on-error: true - name: Terraform Show plan if: github.event_name == 'pull_request' - run: echo terraform_plan=$(terraform show ${{ vars.plan_cache }}/${{ github.sha }}) >> $GITHUB_ENV + run: echo terraform_plan=$(terraform show -no-color ${{ vars.plan_cache }}/${{ github.sha }}) >> $GITHUB_ENV - name: Post Terraform Plan to PR uses: CSVD/gh-actions-github-script@v6 @@ -90,6 +90,7 @@ jobs: github-token: ${{ secrets.GH_TOKEN }} script: | const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` + #### Terraform Plan ID: \`${{ github.sha }}\` #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
Validation Output From 2fe7ff520eacb497a6071e41732f5f532a4cb464 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 15 Aug 2024 15:50:05 -0700 Subject: [PATCH 08/11] Update terraform_plan.yaml --- .github/workflows/terraform_plan.yaml | 36 +++++++++++---------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index 256518c..cf814d4 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -81,7 +81,7 @@ jobs: if: github.event_name == 'pull_request' run: echo terraform_plan=$(terraform show -no-color ${{ vars.plan_cache }}/${{ github.sha }}) >> $GITHUB_ENV - - name: Post Terraform Plan to PR + - name: Post Terraform Stats to PR uses: CSVD/gh-actions-github-script@v6 if: github.event_name == 'pull_request' env: @@ -93,29 +93,23 @@ jobs: #### Terraform Plan ID: \`${{ github.sha }}\` #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` -
Validation Output - - \`\`\`\n - ${{ steps.validate.outputs.stdout }} - \`\`\` - -
- - #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` - -
Show Plan - - \`\`\`\n - ${process.env.PLAN} - \`\`\` - -
- - *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`; - + github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: output }) + + - name: Post Terraform Plan to PR + uses: CSVD/gh-actions-github-script@v6 + if: github.event_name == 'pull_request' + with: + github-token: ${{ secrets.GH_TOKEN }} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: ${{ env.terraform_plan }} + }) From 59045e18032ed43f8a8ba65c4305109937a60f93 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 15 Aug 2024 15:54:24 -0700 Subject: [PATCH 09/11] Update terraform_plan.yaml --- .github/workflows/terraform_plan.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index cf814d4..4754572 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -92,7 +92,7 @@ jobs: const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` #### Terraform Plan ID: \`${{ github.sha }}\` #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` - #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` + #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`; github.rest.issues.createComment({ issue_number: context.issue.number, From 99e2f933a219ee1ffd1cf2aa899aea1ef33be750 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 15 Aug 2024 16:05:38 -0700 Subject: [PATCH 10/11] Update terraform_plan.yaml --- .github/workflows/terraform_plan.yaml | 29 ++++++++++++--------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index 4754572..0b58691 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -89,27 +89,24 @@ jobs: with: github-token: ${{ secrets.GH_TOKEN }} script: | + const plan=${process.env.PLAN}; const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` - #### Terraform Plan ID: \`${{ github.sha }}\` #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` - #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`; - + #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` +
Validation Output + \`\`\`\n + ${{ steps.validate.outputs.stdout }} + \`\`\` +
+ #### Terraform Plan ID: \`${{ github.sha }}\` + #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` +
Plan + \`${ env.terraform_plan }\` +
+ *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`; github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: output }) - - - name: Post Terraform Plan to PR - uses: CSVD/gh-actions-github-script@v6 - if: github.event_name == 'pull_request' - with: - github-token: ${{ secrets.GH_TOKEN }} - script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: ${{ env.terraform_plan }} - }) From 95767c6d6517d7b6c88bc0950d2384593f911acf Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 15 Aug 2024 16:10:34 -0700 Subject: [PATCH 11/11] Update terraform_plan.yaml --- .github/workflows/terraform_plan.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index 0b58691..74f6644 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -101,7 +101,7 @@ jobs: #### Terraform Plan ID: \`${{ github.sha }}\` #### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
Plan - \`${ env.terraform_plan }\` + ${{ env.terraform_plan }}
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`; github.rest.issues.createComment({