Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions infrastructure/modules/logic-app-slack-alert/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,31 +72,10 @@ resource "azurerm_logic_app_action_custom" "post_to_slack" {
"type": "header",
"text": {
"type": "plain_text",
"text": "@{if(equals(triggerBody()?['data']?['essentials']?['monitorCondition'], 'Resolved'), concat('✅ Resolved – ', triggerBody()?['data']?['essentials']?['alertRule']), concat('🚨 Alert – ', triggerBody()?['data']?['essentials']?['alertRule']))}",
"text": "@{concat(if(equals(triggerBody()?['data']?['essentials']?['monitorCondition'], 'Resolved'), concat('✅ ', triggerBody()?['data']?['essentials']?['severity'], ' resolved'), concat('🚨 ', triggerBody()?['data']?['essentials']?['severity'], ' alert')), ' – ', triggerBody()?['data']?['essentials']?['alertRule'], if(empty(coalesce(triggerBody()?['data']?['essentials']?['configurationItems']?[0], '')), '', concat(' (resource: `', triggerBody()?['data']?['essentials']?['configurationItems']?[0], '`)')))}",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type for the header is plain_text — may need to switch to mrkdwn to get formatting for the backticks used here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep makes sense.

I'm not really happy with this PR as it is though, so going to close it for now as I don't really have the bandwidth to get it into a good state atm. The result is still verbose and it might be better to come up with a new format from scratch.

I think you should be able to see at a glance what the error is about. Ideally I would swap out terraform names like "appi-preprod-uks-manbrs-exceptions-alert" for descriptive text like "high exception rate: manage-breast-screening".

"emoji": true
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "@{concat('*Severity*\n', triggerBody()?['data']?['essentials']?['severity'])}"
},
{
"type": "mrkdwn",
"text": "@{concat('*Status*\n', triggerBody()?['data']?['essentials']?['monitorCondition'])}"
},
{
"type": "mrkdwn",
"text": "@{if(equals(triggerBody()?['data']?['essentials']?['monitorCondition'], 'Resolved'), concat('*Resolved At*\n', triggerBody()?['data']?['essentials']?['resolvedDateTime']), concat('*Fired At*\n', triggerBody()?['data']?['essentials']?['firedDateTime']))}"
},
{
"type": "mrkdwn",
"text": "@{concat('*Resource*\n`', coalesce(triggerBody()?['data']?['essentials']?['configurationItems']?[0], 'N/A'), '`')}"
}
]
},
{
"type": "section",
"text": {
Expand Down
Loading