Skip to content

Commit

Permalink
azurerm_monitor_diagnostic_setting - fix `log_analytics_destination…
Browse files Browse the repository at this point in the history
…_type` (#20203)
  • Loading branch information
teowa authored Feb 24, 2023
1 parent 0bbd2ee commit 22aff45
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func resourceMonitorDiagnosticSetting() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: false,
Default: "AzureDiagnostics",
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
"Dedicated",
"AzureDiagnostics", // Not documented in azure API, but some resource has skew. See: https://github.com/Azure/azure-rest-api-specs/issues/9281
Expand Down Expand Up @@ -564,7 +564,11 @@ func resourceMonitorDiagnosticSettingRead(d *pluginsdk.ResourceData, meta interf
d.Set("partner_solution_id", partnerSolutionId)
}

d.Set("log_analytics_destination_type", resp.Model.Properties.LogAnalyticsDestinationType)
logAnalyticsDestinationType := ""
if resp.Model.Properties.LogAnalyticsDestinationType != nil && *resp.Model.Properties.LogAnalyticsDestinationType != "" {
logAnalyticsDestinationType = *resp.Model.Properties.LogAnalyticsDestinationType
}
d.Set("log_analytics_destination_type", logAnalyticsDestinationType)

enabledLogs := flattenMonitorDiagnosticEnabledLogs(resp.Model.Properties.Logs)
if err = d.Set("enabled_log", enabledLogs); err != nil {
Expand Down
Loading

0 comments on commit 22aff45

Please sign in to comment.