Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logic app slack #8029

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b89f912
added api connections for workflow
shanice-skylight Aug 13, 2024
b224656
modified workflow action body text
shanice-skylight Aug 13, 2024
b0667f8
added id attribute to managed api reference
shanice-skylight Aug 13, 2024
9eac44e
added azapi resource to create managed api
shanice-skylight Aug 14, 2024
0e1332b
removed additional api connection
shanice-skylight Aug 14, 2024
a46a777
added a provider to pentest
shanice-skylight Aug 14, 2024
f4eea58
added provider to alert_app module
shanice-skylight Aug 14, 2024
3bc3b6c
provider.tf file content
shanice-skylight Aug 14, 2024
a36dc6f
fixed connection reference and removed resource azurerm_logic_app_api…
shanice-skylight Aug 14, 2024
2dea173
modified attribute being called
shanice-skylight Aug 14, 2024
2c140bd
modified resource azapi_resource type
shanice-skylight Aug 14, 2024
ac69376
turned off schema validation
shanice-skylight Aug 14, 2024
d71e2a3
modified reference to subscription
shanice-skylight Aug 14, 2024
456d0b1
modified api connection reference to managed api id
shanice-skylight Aug 14, 2024
0fde7d9
added new local variables to identify slack api and connection
shanice-skylight Aug 14, 2024
2e3dc25
added a key to the parameters
shanice-skylight Aug 14, 2024
40ac781
modified action body, connection parameter, and removed logic app cus…
shanice-skylight Aug 15, 2024
2c58a03
fixed parameter named connections
shanice-skylight Aug 15, 2024
48cd6e5
removed comments and resources no longer used, added logic app receiver
shanice-skylight Aug 15, 2024
8845026
modified the body of the alert and updated the channel alerts are sen…
shanice-skylight Aug 16, 2024
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
Prev Previous commit
Next Next commit
added new local variables to identify slack api and connection
  • Loading branch information
shanice-skylight committed Aug 14, 2024
commit 0fde7d98921b27153f3267f4b601253249c98aec
35 changes: 12 additions & 23 deletions ops/services/alerts/alert_app/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@ locals {
prime-app = "simple-report"
resource_group = data.azurerm_resource_group.rg.name
}
slack_api_id = "${data.azurerm_subscription.primary.id}/resourceGroups/${data.azurerm_resource_group.rg.name}/providers/Microsoft.Web/locations/${data.azurerm_resource_group.rg_global.location}/managedApis/slack"
slack_connection_id = "${data.azurerm_subscription.primary.id}/resourceGroups/${data.azurerm_resource_group.rg.name}/providers/Microsoft.Web/connections/${var.slackConnectionName}"

}


# Define the Logic App Workflow
resource "azurerm_logic_app_workflow" "slack_workflow" {
name = var.logicAppName
location = data.azurerm_resource_group.rg.location
#Create below api_connection
parameters = {
connections = azurerm_api_connection.api_connection_1.id
connections = local.slack_api_id
}
resource_group_name = data.azurerm_resource_group.rg.name
workflow_parameters = {
connection = "{\"defaultValue\":{},\"type\":\"Object\"}"
connection = jsonencode({
name = local.slack_connection_id
})
}
}

Expand All @@ -44,9 +48,9 @@ resource "azurerm_logic_app_action_custom" "res-3" {
body = jsonencode({
inputs = {
host = {
connection = {
name = azurerm_api_connection.api_connection_1.name
}
connection = jsonencode({
name = local.slack_connection_id
})
}
method = "post"
path = "/chat.postMessage"
Expand Down Expand Up @@ -95,17 +99,7 @@ resource "azurerm_logic_app_trigger_http_request" "res-4" {

}

# resource "azurerm_logic_app_api_connection" "slack" {
# name = var.slackConnectionName
# location = data.azurerm_resource_group.rg.location
# resource_group_name = data.azurerm_resource_group.rg.name
#
# api {
# id = "/subscriptions/${data.azurerm_subscription.primary.id}/providers/Microsoft.Web/locations/${data.azurerm_resource_group.rg_global.location}/managedApis/${var.connection_name}"
# }
#
# display_name = "slack"
# }



resource "azapi_resource" "createApiConnectionslack" {
Expand Down Expand Up @@ -139,12 +133,7 @@ resource "azurerm_api_connection" "api_connection_1" {
name = "SlackConnection"
resource_group_name = data.azurerm_resource_group.rg.name
}
#
# resource "azurerm_api_connection" "res-6" {
# managed_api_id = azapi_resource.createApiConnectionslack.id
# name = "slack-1"
# resource_group_name = data.azurerm_resource_group.rg.name
# }




Expand Down
Loading