From 17735551799200c9413675ff97dc3a544bf53fa5 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Thu, 15 Aug 2024 13:02:31 -0700 Subject: [PATCH] GitHub script (#4) * Update terraform_plan.yaml * Update terraform_plan.yaml * Update terraform_plan.yaml * Update terraform_plan.yaml * Update terraform_plan.yaml * Update backend.tf * Update terraform_plan.yaml * Update terraform_plan.yaml * Update terraform_plan.yaml * Update terraform_plan.yaml * Update terraform_plan.yaml * Update terraform_plan.yaml * Update terraform_plan.yaml * Update terraform_plan.yaml * Update terraform_plan.yaml * Autoformatting TF Code * Refactor image pipeline module names and update workflows * Refactor image pipeline module names and update workflows * Update terraform_plan.yaml * Update terraform-plan.yaml.tpl --------- Co-authored-by: arnol377 Co-authored-by: Dave Arnold --- .github/workflows/terraform_plan.yaml | 3 ++- backend.tf | 2 +- workflows/terraform-plan.yaml.tpl | 8 +++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index 27c283f..e8eb613 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -71,7 +71,8 @@ jobs: run: terraform plan -no-color continue-on-error: true - - uses: CSVD/gh-actions-github-script@v6 + - 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 }}" diff --git a/backend.tf b/backend.tf index 9f61e98..aa514fb 100644 --- a/backend.tf +++ b/backend.tf @@ -1,7 +1,7 @@ terraform { backend "s3" { bucket = "inf-tfstate-229685449397" - key = "csvd-dev-gov/common/apps/terraform-repos" + key = "csvd-dev-gov/common/apps/terraform-repos" region = "us-gov-east-1" dynamodb_table = "tf_remote_state" } diff --git a/workflows/terraform-plan.yaml.tpl b/workflows/terraform-plan.yaml.tpl index c941500..f4a20cb 100644 --- a/workflows/terraform-plan.yaml.tpl +++ b/workflows/terraform-plan.yaml.tpl @@ -24,7 +24,9 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 - + with: + ref: $${{ github.head_ref }} + token: $${{ secrets.GH_TOKEN }} - uses: CSVD/gh-actions-setup-node@v3 with: @@ -48,7 +50,7 @@ jobs: - name: Autoformat Halt if: env.auto_format == 'true' - run: exit 1 + run: exit 0 - name: Terraform Init id: init @@ -90,4 +92,4 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, body: output - }) \ No newline at end of file + })