Migrate OMS agent to AMA agent (in terraform)
Hi,
I have Azure resources managed in terraform. I'm not really a "good friend" with terraform, but I was chosen to migrate OMS agents to the new AMA agent. I know a migration guides exists, I went through it, but I either do not understand it or I have some weird use case.
Currently, there these resources in terraform
resource "azurerm_log_analytics_solution" "log_analytics_solution" {
solution_name = "ContainerInsights"
location = "location"
resource_group_name = "<resourceGroupName>"
workspace_resource_id = azurerm_log_analytics_workspace.aks_cluster_log_analytics.id
workspace_name = azurerm_log_analytics_workspace.aks_cluster_log_analytics.name
plan {
publisher = "Microsoft"
product = "OMSGallery/ContainerInsights"
}
tags = merge(var.default_tags)
}
I believe, this is the result of the above setup
And then, the cluster itself has this (I have omitted most of the fields)
resource "azurerm_kubernetes_cluster" "aks_cluster" {
...
oms_agent {
log_analytics_workspace_id = azurerm_log_analytics_workspace.aks_cluster_log_analytics.id
}
....
}
Regarding this and the cluster, I have found, that using oms_agent
deploys the AMA agent anyway https://github.com/Azure/AKS/issues/4208 This cluster has been created some while ago, is this still true? Is there a way to find out? (I do have some doubts, because from my understanding, the AMA agent needs DCR and I have not found any DCR)
I have also tried the AMA Migration Helper
workbook and MMA discovery and Removal Utility
. Both of these point to one VM. When I open the VM and then Extensions, I can see this:
I believe this is the OMS agent that needs to migrated. Am I correct here? I have not found any configuration for this agent anywhere. My only assumption is, that I need to add AMA extension using terrraform
resource "azurerm_virtual_machine_extension" "ama_extension" {
name = "AzureMonitorLinuxAgent"
virtual_machine_id = azurerm_windows_virtual_machine.virtual_machine.id
publisher = "Microsoft.Azure.Monitor"
type = "AzureMonitorWindowsAgent"
type_handler_version = "1.0"
settings = jsonencode({
"dataCollectionRule" = "<dcr-id>"
})
}
But honestly, I don't know what should be included in the DCR for it to have the same "effect" as the current OMS agent.
So, overall my questions are:
- Am I correct with my assumption, that the way the cluster is setup in terraform, it does not need any changes? Meaning, it already uses the AMA agent.
- Am I correct with my assumption, that the current extension listed in the VM is indeed the OMS agent, that needs to be migrated?