Skip to content

Commit

Permalink
azurerm_monitor_diagnostic_setting - fix tests caused by service AP…
Browse files Browse the repository at this point in the history
…I behavior change (#19762)
  • Loading branch information
teowa authored Dec 21, 2022
1 parent 5c310f0 commit 563a2b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,7 @@ func resourceMonitorDiagnosticSettingCreateUpdate(d *pluginsdk.ResourceData, met
}

if v := d.Get("log_analytics_destination_type").(string); v != "" {
if workspaceId != "" {
parameters.Properties.LogAnalyticsDestinationType = &v
} else {
return fmt.Errorf("`log_analytics_workspace_id` must be set for `log_analytics_destination_type` to be used")
}
parameters.Properties.LogAnalyticsDestinationType = &v
}

if !valid {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ resource "azurerm_monitor_diagnostic_setting" "test" {
target_resource_id = azurerm_key_vault.test.id
eventhub_authorization_rule_id = azurerm_eventhub_namespace_authorization_rule.test.id
eventhub_name = azurerm_eventhub.test.name
log_analytics_destination_type = "AzureDiagnostics"
log {
category = "AuditEvent"
Expand Down Expand Up @@ -304,6 +305,7 @@ resource "azurerm_monitor_diagnostic_setting" "test" {
target_resource_id = azurerm_key_vault.test.id
eventhub_authorization_rule_id = azurerm_eventhub_namespace_authorization_rule.test.id
eventhub_name = azurerm_eventhub.test.name
log_analytics_destination_type = "AzureDiagnostics"
log {
category_group = "Audit"
Expand Down Expand Up @@ -396,9 +398,10 @@ resource "azurerm_key_vault" "test" {
}
resource "azurerm_monitor_diagnostic_setting" "test" {
name = "acctest-DS-%[1]d"
target_resource_id = azurerm_key_vault.test.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id
name = "acctest-DS-%[1]d"
target_resource_id = azurerm_key_vault.test.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.test.id
log_analytics_destination_type = "AzureDiagnostics"
log {
category = "AuditEvent"
Expand Down Expand Up @@ -594,9 +597,10 @@ resource "azurerm_elastic_cloud_elasticsearch" "test" {
}
resource "azurerm_monitor_diagnostic_setting" "test" {
name = "acctest-DS-%[1]d"
target_resource_id = azurerm_key_vault.test.id
partner_solution_id = azurerm_elastic_cloud_elasticsearch.test.id
name = "acctest-DS-%[1]d"
target_resource_id = azurerm_key_vault.test.id
partner_solution_id = azurerm_elastic_cloud_elasticsearch.test.id
log_analytics_destination_type = "AzureDiagnostics"
log {
category = "AuditEvent"
Expand Down Expand Up @@ -659,9 +663,10 @@ resource "azurerm_key_vault" "test" {
}
resource "azurerm_monitor_diagnostic_setting" "test" {
name = "acctest-DS-%[1]d"
target_resource_id = azurerm_key_vault.test.id
storage_account_id = azurerm_storage_account.test.id
name = "acctest-DS-%[1]d"
target_resource_id = azurerm_key_vault.test.id
storage_account_id = azurerm_storage_account.test.id
log_analytics_destination_type = "AzureDiagnostics"
log {
category = "AuditEvent"
Expand Down Expand Up @@ -722,9 +727,10 @@ resource "azurerm_storage_account" "test" {
resource "azurerm_monitor_diagnostic_setting" "test" {
name = "acctest-DS-%[1]d"
target_resource_id = data.azurerm_subscription.current.id
storage_account_id = azurerm_storage_account.test.id
name = "acctest-DS-%[1]d"
target_resource_id = data.azurerm_subscription.current.id
storage_account_id = azurerm_storage_account.test.id
log_analytics_destination_type = "AzureDiagnostics"
log {
category = "Administrative"
Expand Down

0 comments on commit 563a2b7

Please sign in to comment.