-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Support for Azure Monitor Data Collection Rules #9679
Comments
Here's a CLI implementation waiting for the resource
And the template file
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Giving this a bump. The Azure Monitoring Agent (AMA) is due to go GA very soon and switching to the AMA and Data Collection Rules (DCRs) would fix so many issues. AMA should reach feature parity against the older agents (e.g. MMA, Dependency agent) so switching to this will address long standing gaps in Terraform for Agent configuration such as issue #3182 and the matching REST API issues. Thanks to @BzSpi for providing the null provider REST API workaround. I'll be stealing that in the meantime! |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@katbyte Note that Microsoft have pushed the Log Analytics Agent on an EOL path and started a marketing campaign to migrate uses to the new Azure Monitor Agent with a migration plan including creating the Data Collection Rules. As Microsoft are now urging customers to migrate, can this issue get some focus so that we can migrate? This is the docs Microsoft are pushing to people in order to migrate: https://docs.microsoft.com/en-us/azure/azure-monitor/agents/azure-monitor-agent-migration |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
The code I've put above has been integrated in a module and will be updated as soon as the resource will be available if this helps. This is a submodule of a more global module that aims to deploy everything necessary for VM run in production. |
Bump, please can this issue get some focus so that we can migrate? |
It's a pity this is taking so long to be supported. For now using Powershell scripting but the REST version of the Claranet PCP is a good alternative |
Having support for Data Collection Rules and Data Collection Rules Associations for VMs would be greatly appreciated for migrating to Azure Monitor |
came to this link after searching for DCR support on TF. Whats the recommend workaround until than ? |
Hi @nitish81. You could use the new azapi resource provider as a workaround until the resource type is supported in the azurerm provider. Here is a working config I pulled together earlier in https://github.com/richeney/azapi. Here is the main.tf: terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.1"
}
azapi = {
source = "azure/azapi"
version = "~>0.1"
}
}
}
provider "azurerm" {
features {}
}
provider "azapi" {}
resource "azurerm_resource_group" "example" {
name = var.resource_group_name
location = var.location
}
resource "azurerm_log_analytics_workspace" "central_workspace" {
name = "centralWorkspace"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku = "PerGB2018"
retention_in_days = 30
}
resource "azapi_resource" "example_dcr" {
name = "example"
parent_id = azurerm_resource_group.example.id
type = "Microsoft.Insights/dataCollectionRules@2021-04-01"
location = var.location
body = templatefile("example.dcr.json.tftpl", {
"workspace_id" : azurerm_log_analytics_workspace.central_workspace.id
})
}
resource "azapi_resource" "example_dcr_association" {
name = "example"
parent_id = azurerm_linux_virtual_machine.example.id
type = "Microsoft.Insights/dataCollectionRuleAssociations@2021-04-01"
body = jsonencode({
properties = {
dataCollectionRuleId = azapi_resource.example_dcr.id
}
})
}
output "workspace_id" {
value = azurerm_log_analytics_workspace.central_workspace.id
}
output "dcr_id" {
value = azapi_resource.example_dcr.id
}
output "dcr_association_id" {
value = azapi_resource.example_dcr_association.id
} |
This functionality has been released in v3.15.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Description
With the new Azure Monitor Guest Health agent extension, there is a condition that the enabling of this agent creates a required Data Collection Rule in Azure Monitor for VMInsights for this to work.
Please can we support the
Microsoft.Insights/dataCollectionRules
namespace as per the Azure API: https://docs.microsoft.com/en-us/rest/api/monitor/datacollectionrulesNew or Affected Resource(s)
Potential Terraform Configuration
References
https://docs.microsoft.com/en-us/rest/api/monitor/datacollectionrules
#0000
The text was updated successfully, but these errors were encountered: