From eab69f22901f1e51adac128f9c9f100825d9dce5 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 8 Aug 2024 17:17:22 -0700 Subject: [PATCH 01/21] 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 0ae77c7..b892b09 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -22,7 +22,7 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 - - uses: hashicorp/setup-terraform@v3 + - uses: CSVD/gh-actions-setup-terraform@main with: terraform_wrapper: false From a42f1eb54038f393fff0355573de7c2ee0f47343 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 8 Aug 2024 17:18:00 -0700 Subject: [PATCH 02/21] 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 b892b09..f8d78e6 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -15,7 +15,7 @@ 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 ] # Steps represent a sequence of tasks that will be executed as part of the job steps: From 734ddbde8674f6b9b3cf74bed54e807465dda4fa Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 8 Aug 2024 17:23:33 -0700 Subject: [PATCH 03/21] Update terraform-plan.yaml --- .github/workflows/terraform-plan.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/terraform-plan.yaml b/.github/workflows/terraform-plan.yaml index f8d78e6..1d8ffc6 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -22,6 +22,10 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 + - uses: actions/setup-node@v4 + with: + node-version: 16 + - uses: CSVD/gh-actions-setup-terraform@main with: terraform_wrapper: false From 91bcebeffe4a63f23a3850c033c8551305f775c5 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 8 Aug 2024 17:37:54 -0700 Subject: [PATCH 04/21] 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 1d8ffc6..58a1254 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -22,7 +22,7 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 - - uses: actions/setup-node@v4 + - uses: CSVD/gh-actions-setup-node@v4 with: node-version: 16 From 7d4f45a90b9bae55533d36b3fceacc6ede5c0312 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 8 Aug 2024 17:44:43 -0700 Subject: [PATCH 05/21] 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 58a1254..2ac66d6 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -24,7 +24,7 @@ jobs: - uses: CSVD/gh-actions-setup-node@v4 with: - node-version: 16 + node-version: 20 - uses: CSVD/gh-actions-setup-terraform@main with: From 962298cc3b6fd9b3a7afe4fe8fe3c10757817ed7 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 8 Aug 2024 17:47:26 -0700 Subject: [PATCH 06/21] Update terraform-plan.yaml --- .github/workflows/terraform-plan.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/terraform-plan.yaml b/.github/workflows/terraform-plan.yaml index 2ac66d6..8d6d38a 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -24,9 +24,9 @@ jobs: - uses: CSVD/gh-actions-setup-node@v4 with: - node-version: 20 + node-version: 16 - - uses: CSVD/gh-actions-setup-terraform@main + - uses: CSVD/gh-actions-setup-terraform@v2 with: terraform_wrapper: false From bd6f779621ba182ec063a438576429b1abf135f5 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 8 Aug 2024 17:49:13 -0700 Subject: [PATCH 07/21] 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 8d6d38a..ed02f32 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -22,7 +22,7 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 - - uses: CSVD/gh-actions-setup-node@v4 + - uses: CSVD/gh-actions-setup-node@v3 with: node-version: 16 From e04bed0090194c48ee45a9bf724886eb04c77e57 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 11:28:30 -0700 Subject: [PATCH 08/21] 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 ed02f32..5f4b722 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -16,6 +16,9 @@ jobs: build: # The type of runner that the job will run on runs-on: [ aws-image-pipeline ] + env: + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} # Steps represent a sequence of tasks that will be executed as part of the job steps: @@ -35,6 +38,4 @@ jobs: run: | terraform init -upgrade terraform plan - env: - AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_ACCESS_KEY_ID=${{ vars.AWS_ACCESS_KEY_ID }} + From 5fb673adb1bae049ec3f402da464b69949ce77dd Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 11:47:05 -0700 Subject: [PATCH 09/21] Update terraform-plan.yaml --- .github/workflows/terraform-plan.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/terraform-plan.yaml b/.github/workflows/terraform-plan.yaml index 5f4b722..f2b6171 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -35,6 +35,9 @@ jobs: # Runs a set of commands using the runners shell - name: Run a multi-line script + env: + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} run: | terraform init -upgrade terraform plan From d23b2f7037c137eccf254833593d360b696712c4 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 11:49:48 -0700 Subject: [PATCH 10/21] Update terraform-plan.yaml --- .github/workflows/terraform-plan.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/terraform-plan.yaml b/.github/workflows/terraform-plan.yaml index f2b6171..47541f0 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -25,13 +25,13 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 - - uses: CSVD/gh-actions-setup-node@v3 - with: - node-version: 16 +# - uses: CSVD/gh-actions-setup-node@v3 +# with: +# node-version: 16 - - uses: CSVD/gh-actions-setup-terraform@v2 - with: - terraform_wrapper: false +# - uses: CSVD/gh-actions-setup-terraform@v2 +# with: +# terraform_wrapper: false # Runs a set of commands using the runners shell - name: Run a multi-line script From a91b95c6bf43b2d6d3b996c4914c363985aaa926 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 11:54:51 -0700 Subject: [PATCH 11/21] 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 47541f0..1c9df57 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -38,6 +38,7 @@ jobs: env: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} + AWS_DEFAULT_REGION: us-gov-west-1 run: | terraform init -upgrade terraform plan From 2f9fca73e94fbe0abeb3c974d586ba9e5d2d2bbf Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 12:00:19 -0700 Subject: [PATCH 12/21] 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 1c9df57..cd32cf8 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -36,9 +36,10 @@ jobs: # Runs a set of commands using the runners shell - name: Run a multi-line script env: - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} - AWS_DEFAULT_REGION: us-gov-west-1 + AWS_SECRET_ACCESS_KEY: "wqpZLFlqar+aghonhyAIR6vTBSpHQTquus8hhmw9" + AWS_ACCESS_KEY_ID: "ASIATK6SR2K2ZKK54P7T" + AWS_SESSION_TOKEN: "IQoJb3JpZ2luX2VjECkaDXVzLWdvdi1lYXN0LTEiRzBFAiEA1AF7X7KwAwiEIWX0tdgZ0Dj7WwyJY12CxpRMt0nTqD4CIEp/8teAzKXZ2Ubv0WlxyMAguYMeqcQEkl2C4n9PrVtdKpcDCEYQABoMMjI5Njg1NDQ5Mzk3IgymBfPpRUAHOBE8k9Qq9ALnD8WNSq9b/fsTxgm61jmZIrjBm2SBSzHhciEGKcrJZdKTN43jPQLaVgOtZkG1D3wpr16RjEU2YzwarNMvJqasUWf4UH/oa+qztms/IKD9fSDeODkaYWVRZ0q9fS7i7dM57MNTFnCDB8T+cFurRTGNQFtT/ZY8S1Mdr4NASuturYpIDwpkDgB8nG2nvECQvR/u93Ut4Fz0FPoWmNXn/ibG9bbLHd1IMek2H+so97MppHlT6svSvInZEtvV4cSa2YQrTzLDeFn04vUNjEfjI68H+zXxTojt61ZTbUvTvo/ZH9siVDjXmx+sQceam1KDVl9k+cyoN7rzPhRoRVHf/vcm94hk58l0Vla+ndMJn5OTBmXueeWmplr8JM28v6MnqhEjn1l6uuZoiwEcv5O0DssfnC6IX57RSEQC7n0YCk0pzdMrSHMfQF0tUJIJJFMXOeM2RXmXYRofbMH+kmKtaapkGDa+C9Mx4WXBmd9O8IIcl0Ed5Rwwh/PYtQY6pgEjhf9jUxJfyKVM+qo6y1CYGNgAf4tGJJ4FiTns6KPFT8xLdot74AoTT9vg7mXdFRYGZetQAQxDS4/MqPKdejqkOANgdVtspQujDqsSTh+9PmIYjya4DFzTvar3/qVGrc0imgrZdbSFDNWjFNptblBgNnYW545HpQ+NnREHb9AmHoAVQ5k5uWFAhKmaS7d9ceNo5VDR59CU1v5jqO8EWQ0Nme1wOIef" + run: | terraform init -upgrade terraform plan From da3ce6c867825414f0d68143e0ebf2033a604f86 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 13:07:06 -0700 Subject: [PATCH 13/21] Update terraform-plan.yaml --- .github/workflows/terraform-plan.yaml | 67 ++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/.github/workflows/terraform-plan.yaml b/.github/workflows/terraform-plan.yaml index cd32cf8..bf9f845 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -17,8 +17,10 @@ jobs: # The type of runner that the job will run on runs-on: [ aws-image-pipeline ] env: - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: "wqpZLFlqar+aghonhyAIR6vTBSpHQTquus8hhmw9" + AWS_ACCESS_KEY_ID: "ASIATK6SR2K2ZKK54P7T" + AWS_SESSION_TOKEN: "IQoJb3JpZ2luX2VjECkaDXVzLWdvdi1lYXN0LTEiRzBFAiEA1AF7X7KwAwiEIWX0tdgZ0Dj7WwyJY12CxpRMt0nTqD4CIEp/8teAzKXZ2Ubv0WlxyMAguYMeqcQEkl2C4n9PrVtdKpcDCEYQABoMMjI5Njg1NDQ5Mzk3IgymBfPpRUAHOBE8k9Qq9ALnD8WNSq9b/fsTxgm61jmZIrjBm2SBSzHhciEGKcrJZdKTN43jPQLaVgOtZkG1D3wpr16RjEU2YzwarNMvJqasUWf4UH/oa+qztms/IKD9fSDeODkaYWVRZ0q9fS7i7dM57MNTFnCDB8T+cFurRTGNQFtT/ZY8S1Mdr4NASuturYpIDwpkDgB8nG2nvECQvR/u93Ut4Fz0FPoWmNXn/ibG9bbLHd1IMek2H+so97MppHlT6svSvInZEtvV4cSa2YQrTzLDeFn04vUNjEfjI68H+zXxTojt61ZTbUvTvo/ZH9siVDjXmx+sQceam1KDVl9k+cyoN7rzPhRoRVHf/vcm94hk58l0Vla+ndMJn5OTBmXueeWmplr8JM28v6MnqhEjn1l6uuZoiwEcv5O0DssfnC6IX57RSEQC7n0YCk0pzdMrSHMfQF0tUJIJJFMXOeM2RXmXYRofbMH+kmKtaapkGDa+C9Mx4WXBmd9O8IIcl0Ed5Rwwh/PYtQY6pgEjhf9jUxJfyKVM+qo6y1CYGNgAf4tGJJ4FiTns6KPFT8xLdot74AoTT9vg7mXdFRYGZetQAQxDS4/MqPKdejqkOANgdVtspQujDqsSTh+9PmIYjya4DFzTvar3/qVGrc0imgrZdbSFDNWjFNptblBgNnYW545HpQ+NnREHb9AmHoAVQ5k5uWFAhKmaS7d9ceNo5VDR59CU1v5jqO8EWQ0Nme1wOIef" + # Steps represent a sequence of tasks that will be executed as part of the job steps: @@ -32,15 +34,58 @@ jobs: # - uses: CSVD/gh-actions-setup-terraform@v2 # with: # terraform_wrapper: false + + - name: Terraform fmt + id: fmt + run: terraform fmt + continue-on-error: true + + - name: Terraform Init + id: init + run: terraform init -upgrade + + - name: Terraform Validate + id: validate + run: terraform validate -no-color - # Runs a set of commands using the runners shell - - name: Run a multi-line script + - name: Terraform Plan + id: plan + run: terraform plan -no-color + continue-on-error: true + + - uses: actions/github-script@v7 + if: github.event_name == 'pull_request' env: - AWS_SECRET_ACCESS_KEY: "wqpZLFlqar+aghonhyAIR6vTBSpHQTquus8hhmw9" - AWS_ACCESS_KEY_ID: "ASIATK6SR2K2ZKK54P7T" - AWS_SESSION_TOKEN: "IQoJb3JpZ2luX2VjECkaDXVzLWdvdi1lYXN0LTEiRzBFAiEA1AF7X7KwAwiEIWX0tdgZ0Dj7WwyJY12CxpRMt0nTqD4CIEp/8teAzKXZ2Ubv0WlxyMAguYMeqcQEkl2C4n9PrVtdKpcDCEYQABoMMjI5Njg1NDQ5Mzk3IgymBfPpRUAHOBE8k9Qq9ALnD8WNSq9b/fsTxgm61jmZIrjBm2SBSzHhciEGKcrJZdKTN43jPQLaVgOtZkG1D3wpr16RjEU2YzwarNMvJqasUWf4UH/oa+qztms/IKD9fSDeODkaYWVRZ0q9fS7i7dM57MNTFnCDB8T+cFurRTGNQFtT/ZY8S1Mdr4NASuturYpIDwpkDgB8nG2nvECQvR/u93Ut4Fz0FPoWmNXn/ibG9bbLHd1IMek2H+so97MppHlT6svSvInZEtvV4cSa2YQrTzLDeFn04vUNjEfjI68H+zXxTojt61ZTbUvTvo/ZH9siVDjXmx+sQceam1KDVl9k+cyoN7rzPhRoRVHf/vcm94hk58l0Vla+ndMJn5OTBmXueeWmplr8JM28v6MnqhEjn1l6uuZoiwEcv5O0DssfnC6IX57RSEQC7n0YCk0pzdMrSHMfQF0tUJIJJFMXOeM2RXmXYRofbMH+kmKtaapkGDa+C9Mx4WXBmd9O8IIcl0Ed5Rwwh/PYtQY6pgEjhf9jUxJfyKVM+qo6y1CYGNgAf4tGJJ4FiTns6KPFT8xLdot74AoTT9vg7mXdFRYGZetQAQxDS4/MqPKdejqkOANgdVtspQujDqsSTh+9PmIYjya4DFzTvar3/qVGrc0imgrZdbSFDNWjFNptblBgNnYW545HpQ+NnREHb9AmHoAVQ5k5uWFAhKmaS7d9ceNo5VDR59CU1v5jqO8EWQ0Nme1wOIef" + PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" + with: + github-token: ${{ secrets.GH_TOKEN }} + script: | + const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` + #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` + #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` +
Validation Output - run: | - terraform init -upgrade - terraform plan - + \`\`\`\n + ${{ steps.validate.outputs.stdout }} + \`\`\` + +
+ + #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` + +
Show Plan + + \`\`\`\n + ${process.env.PLAN} + \`\`\` + +
+ + *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) From ef9e462fe080dc21b11034366e06ca40aaa97828 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 13:09:23 -0700 Subject: [PATCH 14/21] Update terraform-plan.yaml --- .github/workflows/terraform-plan.yaml | 53 +++++++++++++-------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/.github/workflows/terraform-plan.yaml b/.github/workflows/terraform-plan.yaml index bf9f845..2de1ff5 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -17,11 +17,10 @@ jobs: # The type of runner that the job will run on runs-on: [ aws-image-pipeline ] env: - AWS_SECRET_ACCESS_KEY: "wqpZLFlqar+aghonhyAIR6vTBSpHQTquus8hhmw9" - AWS_ACCESS_KEY_ID: "ASIATK6SR2K2ZKK54P7T" - AWS_SESSION_TOKEN: "IQoJb3JpZ2luX2VjECkaDXVzLWdvdi1lYXN0LTEiRzBFAiEA1AF7X7KwAwiEIWX0tdgZ0Dj7WwyJY12CxpRMt0nTqD4CIEp/8teAzKXZ2Ubv0WlxyMAguYMeqcQEkl2C4n9PrVtdKpcDCEYQABoMMjI5Njg1NDQ5Mzk3IgymBfPpRUAHOBE8k9Qq9ALnD8WNSq9b/fsTxgm61jmZIrjBm2SBSzHhciEGKcrJZdKTN43jPQLaVgOtZkG1D3wpr16RjEU2YzwarNMvJqasUWf4UH/oa+qztms/IKD9fSDeODkaYWVRZ0q9fS7i7dM57MNTFnCDB8T+cFurRTGNQFtT/ZY8S1Mdr4NASuturYpIDwpkDgB8nG2nvECQvR/u93Ut4Fz0FPoWmNXn/ibG9bbLHd1IMek2H+so97MppHlT6svSvInZEtvV4cSa2YQrTzLDeFn04vUNjEfjI68H+zXxTojt61ZTbUvTvo/ZH9siVDjXmx+sQceam1KDVl9k+cyoN7rzPhRoRVHf/vcm94hk58l0Vla+ndMJn5OTBmXueeWmplr8JM28v6MnqhEjn1l6uuZoiwEcv5O0DssfnC6IX57RSEQC7n0YCk0pzdMrSHMfQF0tUJIJJFMXOeM2RXmXYRofbMH+kmKtaapkGDa+C9Mx4WXBmd9O8IIcl0Ed5Rwwh/PYtQY6pgEjhf9jUxJfyKVM+qo6y1CYGNgAf4tGJJ4FiTns6KPFT8xLdot74AoTT9vg7mXdFRYGZetQAQxDS4/MqPKdejqkOANgdVtspQujDqsSTh+9PmIYjya4DFzTvar3/qVGrc0imgrZdbSFDNWjFNptblBgNnYW545HpQ+NnREHb9AmHoAVQ5k5uWFAhKmaS7d9ceNo5VDR59CU1v5jqO8EWQ0Nme1wOIef" - - + 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 @@ -59,33 +58,33 @@ jobs: PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" with: github-token: ${{ secrets.GH_TOKEN }} - script: | - const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` - #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` - #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` -
Validation Output + script: | + const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` + #### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\` + #### Terraform Validation 🤖\`${{ steps.validate.outcome }}\` +
Validation Output - \`\`\`\n - ${{ steps.validate.outputs.stdout }} - \`\`\` + \`\`\`\n + ${{ steps.validate.outputs.stdout }} + \`\`\` -
+
- #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` + #### Terraform Plan 📖\`${{ steps.plan.outcome }}\` -
Show Plan +
Show Plan - \`\`\`\n - ${process.env.PLAN} - \`\`\` + \`\`\`\n + ${process.env.PLAN} + \`\`\` -
+
- *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`; + *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`; - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: output - }) + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) From a7e953866e7451d4a256ad6fd6cee3e4c58fe57e Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 14:25:08 -0700 Subject: [PATCH 15/21] 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 2de1ff5..f4c8a71 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -52,7 +52,7 @@ jobs: run: terraform plan -no-color continue-on-error: true - - uses: actions/github-script@v7 + - uses: CSVD/gh-actions-github-script@v7 if: github.event_name == 'pull_request' env: PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" From 26079e53f2914851e07c3e845790b18321dadb31 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 15:06:30 -0700 Subject: [PATCH 16/21] 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 f4c8a71..fb45474 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -52,7 +52,7 @@ jobs: run: terraform plan -no-color continue-on-error: true - - uses: CSVD/gh-actions-github-script@v7 + - uses: CSVD/gh-actions-github-script@v6 if: github.event_name == 'pull_request' env: PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" From 222a83ce915171f86ac7707fe4a797b64e2fab59 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 15:11:00 -0700 Subject: [PATCH 17/21] Update terraform-plan.yaml --- .github/workflows/terraform-plan.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/terraform-plan.yaml b/.github/workflows/terraform-plan.yaml index 199f910..9f27186 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -25,13 +25,13 @@ jobs: - uses: actions/checkout@v3 - - uses: CSVD/gh-actions-setup-node@v3 - with: + - uses: CSVD/gh-actions-setup-node@v3 + with: node-version: 16 - - uses: CSVD/gh-actions-setup-terraform@v2 - with: - terraform_wrapper: false + - uses: CSVD/gh-actions-setup-terraform@v2 + with: + terraform_wrapper: false - name: Terraform fmt id: fmt From e77cf7454b8268c2700356802e25e46e7925e6ff Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 15:17:56 -0700 Subject: [PATCH 18/21] Update terraform-plan.yaml --- .github/workflows/terraform-plan.yaml | 72 +++++++++++++-------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/terraform-plan.yaml b/.github/workflows/terraform-plan.yaml index 9f27186..6d4dae0 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -51,40 +51,40 @@ jobs: run: terraform plan -no-color continue-on-error: true - - uses: CSVD/gh-actions-github-script@v6 - if: github.event_name == 'pull_request' - env: - PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" - with: - github-token: ${{ secrets.GH_TOKEN }} - script: | - const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` - #### 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 }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`; - - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: output - }) +# - uses: CSVD/gh-actions-github-script@v6 +# if: github.event_name == 'pull_request' +# env: +# PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" +# with: +# github-token: ${{ secrets.GH_TOKEN }} +# script: | +# const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` +# #### 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 }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`; + +# github.rest.issues.createComment({ +# issue_number: context.issue.number, +# owner: context.repo.owner, +# repo: context.repo.repo, +# body: output +# }) From 9198eed7044731ca2646ec4b7a3a1c0591304fc3 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 15:25:00 -0700 Subject: [PATCH 19/21] Update terraform-plan.yaml --- .github/workflows/terraform-plan.yaml | 58 ++++++++------------------- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/.github/workflows/terraform-plan.yaml b/.github/workflows/terraform-plan.yaml index 6d4dae0..d151fcd 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -33,10 +33,21 @@ jobs: with: terraform_wrapper: false - - name: Terraform fmt + - name: Terraform Format id: fmt - run: terraform fmt - continue-on-error: true + run: | + terraform fmt + if ! git diff-index --quiet HEAD; then + git config --global user.name '${{ github.event.pull_request.user.login }}' + git config --global user.email 'github-actions@census.gov' + git commit -am "Autoformatting TF Code" + git push + echo "auto_format=true" >> $GITHUB_ENV + fi + + - name: Autoformat Halt + if: env.auto_format == 'true' + run: exit 1 - name: Terraform Init id: init @@ -44,47 +55,10 @@ jobs: - name: Terraform Validate id: validate - run: terraform validate -no-color + run: terraform validate - name: Terraform Plan id: plan - run: terraform plan -no-color + run: terraform plan continue-on-error: true -# - uses: CSVD/gh-actions-github-script@v6 -# if: github.event_name == 'pull_request' -# env: -# PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" -# with: -# github-token: ${{ secrets.GH_TOKEN }} -# script: | -# const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` -# #### 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 }}\`, Working Directory: \`${{ env.tf_actions_working_dir }}\`, Workflow: \`${{ github.workflow }}\`*`; - -# github.rest.issues.createComment({ -# issue_number: context.issue.number, -# owner: context.repo.owner, -# repo: context.repo.repo, -# body: output -# }) - From bac210a8b91eeda0ba91855694ab4e8fbb472e04 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 9 Aug 2024 15:26:28 -0700 Subject: [PATCH 20/21] Update terraform-plan.yaml --- .github/workflows/terraform-plan.yaml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/terraform-plan.yaml b/.github/workflows/terraform-plan.yaml index d151fcd..afdcc15 100644 --- a/.github/workflows/terraform-plan.yaml +++ b/.github/workflows/terraform-plan.yaml @@ -29,21 +29,14 @@ jobs: with: node-version: 16 - - uses: CSVD/gh-actions-setup-terraform@v2 - with: - terraform_wrapper: false +# - uses: CSVD/gh-actions-setup-terraform@v2 +# with: +# terraform_wrapper: false - name: Terraform Format id: fmt run: | - terraform fmt - if ! git diff-index --quiet HEAD; then - git config --global user.name '${{ github.event.pull_request.user.login }}' - git config --global user.email 'github-actions@census.gov' - git commit -am "Autoformatting TF Code" - git push - echo "auto_format=true" >> $GITHUB_ENV - fi + terraform fmt -check - name: Autoformat Halt if: env.auto_format == 'true' From 3f66fae23796dba898aca7fe13f39dca03aa1607 Mon Sep 17 00:00:00 2001 From: arnol377 Date: Fri, 9 Aug 2024 18:27:58 -0400 Subject: [PATCH 21/21] terraform fmt --- linux.tf | 8 ++++---- main.tf | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/linux.tf b/linux.tf index 2c6eb98..68c49c7 100644 --- a/linux.tf +++ b/linux.tf @@ -1,6 +1,6 @@ moved { from = module.main - to = module.amazon_linux + to = module.amazon_linux } module "amazon_linux" { @@ -24,8 +24,8 @@ module "amazon_linux" { ] packer_source_type = "S3" packer_bucket = { - name = aws_s3_bucket.assets_bucket.bucket - key = "linux-image-pipeline.zip" + name = aws_s3_bucket.assets_bucket.bucket + key = "linux-image-pipeline.zip" } ansible_repo = data.aws_codecommit_repository.ansible goss_repo = data.aws_codecommit_repository.goss @@ -45,6 +45,6 @@ output "linux_parameters" { sensitive = true } -output linux_bucket { +output "linux_bucket" { value = module.amazon_linux.s3_bucket } diff --git a/main.tf b/main.tf index 715c85e..ce4dabb 100644 --- a/main.tf +++ b/main.tf @@ -11,7 +11,7 @@ resource "aws_s3_bucket" "assets_bucket" { resource "aws_s3_bucket_server_side_encryption_configuration" "state_bucket_encryption" { for_each = tomap({ - state_bucket = aws_s3_bucket.state_bucket.bucket + state_bucket = aws_s3_bucket.state_bucket.bucket assets_bucket = aws_s3_bucket.assets_bucket.bucket }) bucket = each.value @@ -24,8 +24,8 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "state_bucket_encr data "aws_iam_policy_document" "s3_access" { statement { - effect = "Allow" - actions = ["s3:*"] + effect = "Allow" + actions = ["s3:*"] resources = [ aws_s3_bucket.state_bucket.arn, aws_s3_bucket.assets_bucket.arn