From f3e18a81113605f58a741fc87eeab452a874b806 Mon Sep 17 00:00:00 2001 From: Phil Varner Date: Fri, 17 May 2024 16:40:45 -0400 Subject: [PATCH] fix stage --- .github/workflows/ci.yaml | 1 + .github/workflows/deploy-reusable.yaml | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a5e20d2..677f3d2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,4 +11,5 @@ jobs: secrets: inherit with: project-name: mmw + stage: env.STAGE fd-aws-tf-modules-version: v2.23.0 diff --git a/.github/workflows/deploy-reusable.yaml b/.github/workflows/deploy-reusable.yaml index 374151f..1de3cc2 100644 --- a/.github/workflows/deploy-reusable.yaml +++ b/.github/workflows/deploy-reusable.yaml @@ -6,12 +6,15 @@ on: project-name: required: true type: string + stage: + required: true + type: string fd-aws-tf-modules-version: required: true type: string jobs: - reusable_deploy: + deploy: permissions: id-token: write contents: read @@ -33,7 +36,7 @@ jobs: echo ' encrypt = true' >> config.s3.backend.tf echo " bucket = \"${{ secrets.TF_STATE_BUCKET }}\"" >> config.s3.backend.tf echo " dynamodb_table = \"${{ secrets.TF_STATE_LOCK_TABLE }}\"" >> config.s3.backend.tf - echo " key = \"${{ inputs.project-name }}-${{ secrets.STAGE }}.tfstate\"" >> config.s3.backend.tf + echo " key = \"${{ inputs.project-name }}-${{ inputs.stage }}.tfstate\"" >> config.s3.backend.tf echo " region = \"${{ secrets.AWS_REGION }}\"" >> config.s3.backend.tf echo ' }' >> config.s3.backend.tf echo '}' >> config.s3.backend.tf @@ -67,7 +70,7 @@ jobs: - name: Terraform Plan id: tf_plan - run: terraform plan -var-file="${{ secrets.STAGE }}.tfvars" -out ${{ secrets.STAGE }}.tfplan -lock=false + run: terraform plan -var-file="${{ inputs.stage }}.tfvars" -out ${{ inputs.stage }}.tfplan -lock=false - name: Configure Terraform Apply Credentials id: apply_creds @@ -79,7 +82,7 @@ jobs: - name: Terraform Apply id: tf_apply - run: terraform apply -lock=false -input=false ${{ secrets.STAGE }}.tfplan + run: terraform apply -lock=false -input=false ${{ inputs.stage }}.tfplan - name: Post status to Slack channel id: tf_apply_successs @@ -88,7 +91,7 @@ jobs: uses: slackapi/slack-github-action@v1.26.0 with: channel-id: ${{ secrets.SLACK_CHANNEL_ID }} - slack-message: ":badger_dance: ${{ inputs.project-name }}-${{ secrets.STAGE }}-titiler ${{ github.ref_name }} terraform apply job has succeeded!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + slack-message: ":badger_dance: ${{ inputs.project-name }}-${{ inputs.stage }}-titiler ${{ github.ref_name }} terraform apply job has succeeded!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" env: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} @@ -99,6 +102,6 @@ jobs: uses: slackapi/slack-github-action@v1.26.0 with: channel-id: ${{ secrets.SLACK_CHANNEL_ID }} - slack-message: ":sadpanda: ${{ inputs.project-name }}-${{ secrets.STAGE }}-titiler ${{ github.ref_name }} terraform apply has failed!\n:alert: make sure cleanup job deletes all AWS resources!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + slack-message: ":sadpanda: ${{ inputs.project-name }}-${{ inputs.stage }}-titiler ${{ github.ref_name }} terraform apply has failed!\n:alert: make sure cleanup job deletes all AWS resources!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" env: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} \ No newline at end of file