pulumi-azure icon indicating copy to clipboard operation
pulumi-azure copied to clipboard

DiagnosticSetting for LoadBalancer shows changes on every up

Open muellermatthias opened this issue 3 years ago • 3 comments

I'm currently trying to add DiagnosticSettings for my LoadBalancer. Adding them works fine, but on the next up Pulumi shows me changes for all log and metric categories although nothing changed.

I tested it with Terraform directly and it works as expected there. I'm using the latest Pulumi version (3.9.0) and the latest provider version (4.11.0).

Steps to reproduce

Here is my example code:

import * as azure from "@pulumi/azure";

const resourceGroup = new azure.core.ResourceGroup("resourceGroup");

const law = new azure.operationalinsights.AnalyticsWorkspace("test-law", {
    resourceGroupName: resourceGroup.name,
    sku: "PerGB2018",
})

const lb = new azure.lb.LoadBalancer("test", {
    resourceGroupName: resourceGroup.name,
})

new azure.monitoring.DiagnosticSetting("lb", {
    targetResourceId: lb.id,
    logAnalyticsWorkspaceId: law.id,
    logs:[{
        category: "LoadBalancerAlertEvent",
        enabled: true,
    }, {
        category: "LoadBalancerProbeHealthStatus",
        enabled: true
    }],
    metrics: [{
        category: "AllMetrics",
        enabled: true,
    }]
})
  1. Run pulumi up to create all resources.
  2. Run pulumi up again. It will show the following diff:
      ~ logs   : [
          ~ [0]: {
                  ~ category: "LoadBalancerAlertEvent" => "LoadBalancerAlertEvent"
                  ~ enabled : true => true
                }
          ~ [1]: {
                  ~ category: "LoadBalancerProbeHealthStatus" => "LoadBalancerProbeHealthStatus"
                  ~ enabled : true => true
                }
        ]
      ~ metrics: [
          ~ [0]: {
                  ~ category: "AllMetrics" => "AllMetrics"
                  ~ enabled : true => true
                }
        ]

Applying the change doesn't help or running pulumi up with the --refresh option.

Expected: The plan should show no changes. Actual: See above.

muellermatthias avatar Jul 29 '21 09:07 muellermatthias

I'm using Pulumi.Azure 4.42.0 and am experiencing the exact same issue

Freakazoid182 avatar Jun 28 '22 16:06 Freakazoid182

@Freakazoid182 FYI: As a workaround I used the DiagnosticSetting resource by the Azure Native provider: https://www.pulumi.com/registry/packages/azure-native/api-docs/insights/diagnosticsetting/

muellermatthias avatar Jun 28 '22 16:06 muellermatthias

Thanks! I'll be doing that as well then 🙂

Freakazoid182 avatar Jun 28 '22 16:06 Freakazoid182