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

azurerm_monitor_diagnostic_setting allways want to change log_analytics_destination_type from empty to AzureDiagnostics starting with 3.40.0 #20140

Closed
1 task done
StefanSchoof opened this issue Jan 20, 2023 · 12 comments · Fixed by #20203

Comments

@StefanSchoof
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.3.7

AzureRM Provider Version

3.40.0

Affected Resource(s)/Data Source(s)

azurerm_monitor_diagnostic_setting

Terraform Configuration Files

resource "azurerm_monitor_diagnostic_setting" "subscription" {
  name                       = "Subscription"
  target_resource_id         = data.azurerm_subscription.current.id
  log_analytics_workspace_id = azurerm_log_analytics_workspace.log_analytics.id

  enabled_log {
    category = "Administrative"
  }
  enabled_log {
    category = "Alert"
  }
  enabled_log {
    category = "Recommendation"
  }
  enabled_log {
    category = "ResourceHealth"
  }
  enabled_log {
    category = "Security"
  }
  enabled_log {
    category = "ServiceHealth"
  }
}

Debug Output/Panic Output

{"@level":"info","@message":"azurerm_monitor_diagnostic_setting.subscription: Plan to update","@module":"terraform.ui","@timestamp":"2023-01-20T17:05:28.962335Z","change":{"resource":{"addr":"azurerm_monitor_diagnostic_setting.subscription","module":"","resource":"azurerm_monitor_diagnostic_setting.subscription","implied_provider":"azurerm","resource_type":"azurerm_monitor_diagnostic_setting","resource_name":"subscription","resource_key":null},"action":"update"},"type":"planned_change"}

Expected Behaviour

No changes to the azurerm_monitor_diagnostic_setting is planed

Actual Behaviour

In every plan azurerm_monitor_diagnostic_setting wants to set log_analytics_destination_typeagain to AzureDiagnostics.
grafik

Steps to Reproduce

No response

Important Factoids

This starts with 3.40.0. Is working with 3.39.1

References

No response

@github-actions github-actions bot removed the bug label Jan 20, 2023
@StefanSchoof StefanSchoof changed the title azurerm_monitor_diagnostic_setting allways want to change log_analytics_destination_type from empty AzureDiagnostics azurerm_monitor_diagnostic_setting allways want to change log_analytics_destination_type from empty to AzureDiagnostics starting with 3.40.0 Jan 20, 2023
@tschechniker
Copy link

Hi there,

i face the same issue. This is super annoying because we have many resources with diagnostic settings.

+1 for this!

@krelf75
Copy link

krelf75 commented Jan 24, 2023

Don't know if it helps, but I've noticed that keyvault resources happily accept the AzureDiagnostics value. Wasn't expecting that as Microsoft's own documentation in the REST API specifies that the acceptable values are null and Dedicated, but there it is ...

@Dyhr
Copy link

Dyhr commented Jan 27, 2023

I have my setting set to "Dedicated" and I'm getting the same issue. It seems that it's not reading that property from the resource at all.

@roviracarlos
Copy link

Same issue here, in terraform the setting is set (logAnalyticsDestinationType) but the Get in Microsoft API Rest return null in this setting for most of the resources, only some of them have this setting applied like API Management.

@teowa
Copy link
Contributor

teowa commented Feb 2, 2023

@roviracarlos is right, for some resource the logAnalyticsDestinationTypeproperty is no longer applicable for now, see Azure/azure-rest-api-specs#22400 for detail. I am still contacting with the service team about the API issue to work out a solution.

The diff caused by logAnalyticsDestinationType should not affect the functionality of diagnostic setting. So we can just ignore it. A temp workaround is using ignore_change to ignore the diff.

@asbjorn-wiik
Copy link

asbjorn-wiik commented Feb 6, 2023

This is still an issue in 3.42.0
resource "azurerm_monitor_diagnostic_setting" "datadog" {
for_each = var.enable_datadog_logs ? toset(keys(local.diagnostic_categories)) : toset([])
name = "datadog"
target_resource_id = local.diagnostic_target_resource_ids[each.key]
eventhub_name = local.datadog_eventhub_name
eventhub_authorization_rule_id = local.datadog_eventhub_authorization_rule
log_analytics_destination_type = null
............................

Will still in Terraform Plan or Apply produce a change
module.storage_account_my.azurerm_monitor_diagnostic_setting.datadog["queue"] will be updated in-place
~ resource "azurerm_monitor_diagnostic_setting" "datadog" {
id = "/subscriptions/11111111-2222-3333-4444-123456789012/resourceGroups/weu-stg-rg/providers/Microsoft.Storage/storageAccounts/weustgsa/queueServices/default|datadog"
+ log_analytics_destination_type = "AzureDiagnostics"
name = "datadog"
# (3 unchanged attributes hidden)

    # (8 unchanged blocks hidden)
}

@MarkKharitonov
Copy link

We also have this problem.

Is there an idea when this would be fixed?

@laurilarjo
Copy link
Contributor

Still an issue with 3.44.1

@eyenx
Copy link

eyenx commented Feb 21, 2023

We also have this issue, any news on roadmap?

@indispeq
Copy link

Same issue happening for us, using latest, 3.44.1.

@github-actions
Copy link

This functionality has been released in v3.45.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!

@github-actions
Copy link

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.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet