Skip to content

Commit

Permalink
Merge pull request #21 from vMarkusK/azurerm_connection_monitor
Browse files Browse the repository at this point in the history
Azure connection monitor
  • Loading branch information
vMarkusK authored May 28, 2024
2 parents 4c385bd + 1643835 commit 5a615a1
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hub-law.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource "azurerm_log_analytics_workspace" "law_platform" {
name = "law-platform"
location = azurerm_resource_group.rg_hub.location
resource_group_name = azurerm_resource_group.rg_hub.name
sku = "PerGB2018"
tags = var.tags
}
65 changes: 65 additions & 0 deletions hub-router-monitor.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
resource "azurerm_network_watcher" "networkwatcher_hub" {
name = "network-watcher-hub"
location = azurerm_resource_group.rg_hub.location
resource_group_name = azurerm_resource_group.rg_hub.name
tags = var.tags
}

resource "azurerm_virtual_machine_extension" "ubunturoutervm_networkwatcher" {
name = "${var.hub_router_hostname}-networkwatcher"
virtual_machine_id = module.ubunturoutervm.id
publisher = "Microsoft.Azure.NetworkWatcher"
type = "NetworkWatcherAgentLinux"
type_handler_version = "1.4"
auto_upgrade_minor_version = true
tags = var.tags
}

resource "azurerm_network_connection_monitor" "ubunturoutervm_monitor_ubuntucom" {
name = "${var.hub_router_hostname}-ubuntucom"
network_watcher_id = azurerm_network_watcher.networkwatcher_hub.id
location = azurerm_network_watcher.networkwatcher_hub.location
tags = var.tags

endpoint {
name = "source"
target_resource_id = module.ubunturoutervm.id

filter {
item {
address = module.ubunturoutervm.id
type = "AgentAddress"
}

type = "Include"
}
}

endpoint {
name = "destination"
address = "archive.ubuntu.com"
}

test_configuration {
name = "tcpName"
protocol = "Tcp"
test_frequency_in_seconds = 60

tcp_configuration {
port = 80
}
}

test_group {
name = "ubunturoutervm"
destination_endpoints = ["destination"]
source_endpoints = ["source"]
test_configuration_names = ["tcpName"]
}

notes = "ubunturoutervm-ubuntucom"

output_workspace_resource_ids = [azurerm_log_analytics_workspace.law_platform.id]

depends_on = [azurerm_virtual_machine_extension.ubunturoutervm_networkwatcher]
}

0 comments on commit 5a615a1

Please sign in to comment.