Skip to content

Commit

Permalink
fix stage
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Varner committed May 17, 2024
1 parent 56a3b65 commit f3e18a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ jobs:
secrets: inherit
with:
project-name: mmw
stage: env.STAGE
fd-aws-tf-modules-version: v2.23.0
15 changes: 9 additions & 6 deletions .github/workflows/deploy-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -88,7 +91,7 @@ jobs:
uses: slackapi/[email protected]
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 }}

Expand All @@ -99,6 +102,6 @@ jobs:
uses: slackapi/[email protected]
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 }}

0 comments on commit f3e18a8

Please sign in to comment.