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 - fix log_analytics_destination_type #20203

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ func resourceMonitorDiagnosticSetting() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: false,
Default: "AzureDiagnostics",
teowa marked this conversation as resolved.
Show resolved Hide resolved
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
"AzureDiagnostics",
"Dedicated", // Not documented in azure API, but some resource has skew. See: https://github.com/Azure/azure-rest-api-specs/issues/9281
}, false),
},

Expand Down Expand Up @@ -565,7 +565,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