From 2acc4a7b29ab8faf1b7d0035baffabae11c9e23e Mon Sep 17 00:00:00 2001 From: Kumaraswamy Vithanala <36370570+kumarvna@users.noreply.github.com> Date: Sun, 18 Jul 2021 21:33:14 +0530 Subject: [PATCH] updating examples for version 2.2.0 --- README.md | 2 +- examples/README.md | 4 ++-- examples/linux_vm_scale_sets/README.md | 2 +- examples/linux_vm_scale_sets/main.tf | 2 +- examples/windows_vm_scale_sets/README.md | 2 +- examples/windows_vm_scale_sets/main.tf | 2 +- main.tf | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index fd61976..ce4a197 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ module "vmscaleset" { vmscaleset_name = "testvmss" # (Optional) To enable Azure Monitoring and install log analytics agents + # (Optional) Specify `storage_account_name` to save monitoring logs to storage. log_analytics_workspace_name = var.log_analytics_workspace_name - storage_account_name = var. storage_account_name # Deploy log analytics agents to virtual machine. Log analytics workspace name required. # Defaults to `false` diff --git a/examples/README.md b/examples/README.md index 532a2da..e3af8c5 100644 --- a/examples/README.md +++ b/examples/README.md @@ -27,8 +27,8 @@ module "vmscaleset" { vmscaleset_name = "testvmss" # (Optional) To enable Azure Monitoring and install log analytics agents + # (Optional) Specify `storage_account_name` to save monitoring logs to storage. log_analytics_workspace_name = var.log_analytics_workspace_name - storage_account_name = var.storage_account_name # Deploy log analytics agents to virtual machine. Log analytics workspace name required. # Defaults to `false` @@ -117,8 +117,8 @@ module "vmscaleset" { vm_computer_name = "websrv1" # (Optional) To enable Azure Monitoring and install log analytics agents + # (Optional) Specify `storage_account_name` to save monitoring logs to storage. log_analytics_workspace_name = var.log_analytics_workspace_name - storage_account_name = var.storage_account_name # Deploy log analytics agents to virtual machine. Log analytics workspace name required. # Defaults to `false` diff --git a/examples/linux_vm_scale_sets/README.md b/examples/linux_vm_scale_sets/README.md index e96fcc9..2ecf85a 100644 --- a/examples/linux_vm_scale_sets/README.md +++ b/examples/linux_vm_scale_sets/README.md @@ -21,8 +21,8 @@ module "vmscaleset" { vmscaleset_name = "testvmss" # (Optional) To enable Azure Monitoring and install log analytics agents + # (Optional) Specify `storage_account_name` to save monitoring logs to storage. log_analytics_workspace_name = var.log_analytics_workspace_name - storage_account_name = var.storage_account_name # Deploy log analytics agents to virtual machine. Log analytics workspace name required. # Defaults to `false` diff --git a/examples/linux_vm_scale_sets/main.tf b/examples/linux_vm_scale_sets/main.tf index d8ee8c3..2d838cc 100644 --- a/examples/linux_vm_scale_sets/main.tf +++ b/examples/linux_vm_scale_sets/main.tf @@ -14,8 +14,8 @@ module "vmscaleset" { vmscaleset_name = "testvmss" # (Optional) To enable Azure Monitoring and install log analytics agents + # (Optional) Specify `storage_account_name` to save monitoring logs to storage. log_analytics_workspace_name = var.log_analytics_workspace_name - storage_account_name = var.storage_account_name # Deploy log analytics agents to virtual machine. Log analytics workspace name required. # Defaults to `false` diff --git a/examples/windows_vm_scale_sets/README.md b/examples/windows_vm_scale_sets/README.md index 2b84161..8863377 100644 --- a/examples/windows_vm_scale_sets/README.md +++ b/examples/windows_vm_scale_sets/README.md @@ -22,8 +22,8 @@ module "vmscaleset" { vm_computer_name = "websrv1" # (Optional) To enable Azure Monitoring and install log analytics agents + # (Optional) Specify `storage_account_name` to save monitoring logs to storage. log_analytics_workspace_name = var.log_analytics_workspace_name - storage_account_name = var.storage_account_name # Deploy log analytics agents to virtual machine. Log analytics workspace name required. # Defaults to `false` diff --git a/examples/windows_vm_scale_sets/main.tf b/examples/windows_vm_scale_sets/main.tf index ee26258..5582688 100644 --- a/examples/windows_vm_scale_sets/main.tf +++ b/examples/windows_vm_scale_sets/main.tf @@ -15,8 +15,8 @@ module "vmscaleset" { vm_computer_name = "websrv1" # (Optional) To enable Azure Monitoring and install log analytics agents + # (Optional) Specify `storage_account_name` to save monitoring logs to storage. log_analytics_workspace_name = var.log_analytics_workspace_name - storage_account_name = var.storage_account_name # Deploy log analytics agents to virtual machine. Log analytics workspace name required. # Defaults to `false` diff --git a/main.tf b/main.tf index c9ec656..d2dfa40 100644 --- a/main.tf +++ b/main.tf @@ -484,7 +484,7 @@ resource "azurerm_monitor_diagnostic_setting" "vmmsdiag" { count = var.log_analytics_workspace_name != null && var.storage_account_name != null ? 1 : 0 name = lower("${var.vmscaleset_name}-diag") target_resource_id = var.os_flavor == "windows" ? azurerm_windows_virtual_machine_scale_set.winsrv_vmss.0.id : azurerm_linux_virtual_machine_scale_set.linux_vmss.0.id - storage_account_id = data.azurerm_storage_account.storeacc.0.id + storage_account_id = var.storage_account_name != null ? data.azurerm_storage_account.storeacc.0.id : null log_analytics_workspace_id = data.azurerm_log_analytics_workspace.logws.0.id metric { @@ -500,7 +500,7 @@ resource "azurerm_monitor_diagnostic_setting" "nsg" { count = var.log_analytics_workspace_name != null && var.storage_account_name != null ? 1 : 0 name = lower("nsg-${var.vmscaleset_name}-diag") target_resource_id = azurerm_network_security_group.nsg.id - storage_account_id = data.azurerm_storage_account.storeacc.0.id + storage_account_id = var.storage_account_name != null ? data.azurerm_storage_account.storeacc.0.id : null log_analytics_workspace_id = data.azurerm_log_analytics_workspace.logws.0.id dynamic "log" {