-
Notifications
You must be signed in to change notification settings - Fork 18
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
1 parent
3398e8a
commit 3627525
Showing
1 changed file
with
10 additions
and
12 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 |
---|---|---|
|
@@ -31,7 +31,7 @@ jobs: | |
|
||
- uses: hashicorp/[email protected] | ||
with: | ||
terraform_version: 1.7.5 | ||
terraform_version: latest | ||
|
||
- name: Run terraform fmt | ||
run: terraform fmt -check | ||
|
@@ -49,6 +49,8 @@ jobs: | |
with: | ||
secret-ids: | | ||
SLACK_INCOMING_WEBHOOK,aws-root-account-notifications-incoming-slack-webhook | ||
aws-root-account-notifications-slack-information | ||
parse-json-secrets: true | ||
|
||
- name: Send initial message to Slack | ||
id: slack_message | ||
|
@@ -66,17 +68,13 @@ jobs: | |
# Run Terraform plan and save to plan_output.txt | ||
terraform plan -no-color > plan_output.txt | ||
# Create the payload JSON file | ||
echo '{ | ||
"text": "```"' | ||
cat plan_output.txt | ||
echo '```", | ||
"thread_ts": "'"${{ steps.slack_message.outputs.ts }}"'" | ||
}' > slack_plan_payload.json | ||
- name: Send Terraform plan output to Slack | ||
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d #v2.0.0 | ||
with: | ||
webhook: ${{ env.SLACK_INCOMING_WEBHOOK }} | ||
webhook-type: incoming-webhook | ||
payload_file_path: slack_plan_payload.json | ||
token: ${{ env.AWS_ROOT_ACCOUNT_NOTIFICATIONS_SLACK_INFORMATION_SLACK_BOT_TOKEN }} | ||
method: files.uploadV2 | ||
payload: | | ||
channel: ${{ env.AWS_ROOT_ACCOUNT_NOTIFICATIONS_SLACK_INFORMATION_SLACK_CHANNEL }} | ||
initial_comment: Terraform output attached! | ||
file: "plan_output.txt" | ||
filename: "plan-output-${{ github.run_id }}.txt" |