-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Phil Varner
committed
May 17, 2024
1 parent
56a3b65
commit f3e18a8
Showing
2 changed files
with
10 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ jobs: | |
secrets: inherit | ||
with: | ||
project-name: mmw | ||
stage: env.STAGE | ||
fd-aws-tf-modules-version: v2.23.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[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 }} | ||
|
||
|
@@ -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 }} |