Skip to content

Commit

Permalink
Merge pull request #5 from kumarvna/develop
Browse files Browse the repository at this point in the history
updating examples for version 2.2.0
  • Loading branch information
kumarvna authored Jul 18, 2021
2 parents 274cb6b + 1bca967 commit 0b08c0f
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 18 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ module "virtual-machine" {
virtual_machine_name = "vm-linux"
# (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
hub_storage_account_name = var.hub_storage_account_name
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
Expand Down Expand Up @@ -307,6 +307,9 @@ Name | Description | Type | Default
`dedicated_host_id`|The ID of a Dedicated Host where this machine should be run on|string|`null`
`license_type`|Specifies the type of on-premise license which should be used for this Virtual Machine. Possible values are `None`, `Windows_Client` and `Windows_Server`.|string|`"None"`
`vm_time_zone`|Specifies the Time Zone which should be used by the Virtual Machine. Ex. `"UTC"` or `"W. Europe Standard Time"` [The possible values are defined here](https://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/) |string|`null`
`log_analytics_workspace_name`|The name of log analytics workspace name|string|`null`
`storage_account_name`|The name of the storage account name|string|`null`
`deploy_log_analytics_agent`|Install log analytics agent to windows or linux VM|string|`false`
`Tags`|A map of tags to add to all resources|map|`{}`

## Outputs
Expand Down
6 changes: 3 additions & 3 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ module "virtual-machine" {
virtual_machine_name = "vm-linux"
# (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
hub_storage_account_name = var.hub_storage_account_name
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
Expand Down Expand Up @@ -101,8 +101,8 @@ module "virtual-machine" {
virtual_machine_name = "win-machine"
# (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
hub_storage_account_name = var.hub_storage_account_name
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
Expand Down Expand Up @@ -179,8 +179,8 @@ module "virtual-machine" {
virtual_machine_name = "win-sqlvm"
# (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
hub_storage_account_name = var.hub_storage_account_name
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
Expand Down
2 changes: 1 addition & 1 deletion examples/linux_virtual_machine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ module "virtual-machine" {
virtual_machine_name = "vm-linux"
# (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
hub_storage_account_name = var.hub_storage_account_name
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
Expand Down
2 changes: 1 addition & 1 deletion examples/linux_virtual_machine/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module "virtual-machine" {
virtual_machine_name = "vm-linux"

# (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
hub_storage_account_name = var.hub_storage_account_name

# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
Expand Down
2 changes: 1 addition & 1 deletion examples/linux_virtual_machine/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "log_analytics_workspace_name" {
default = null
}

variable "hub_storage_account_name" {
variable "storage_account_name" {
description = "The name of the hub storage account to store logs"
default = null
}
2 changes: 1 addition & 1 deletion examples/mssql_windows_virtual_machine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ module "virtual-machine" {
virtual_machine_name = "win-sqlvm"
# (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
hub_storage_account_name = var.hub_storage_account_name
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
Expand Down
2 changes: 1 addition & 1 deletion examples/mssql_windows_virtual_machine/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ module "virtual-machine" {
virtual_machine_name = "win-sqlvm"

# (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
hub_storage_account_name = var.hub_storage_account_name

# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
Expand Down
2 changes: 1 addition & 1 deletion examples/mssql_windows_virtual_machine/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "log_analytics_workspace_name" {
default = null
}

variable "hub_storage_account_name" {
variable "storage_account_name" {
description = "The name of the hub storage account to store logs"
default = null
}
2 changes: 1 addition & 1 deletion examples/windows_virtual_machine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ module "virtual-machine" {
virtual_machine_name = "win-machine"
# (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
hub_storage_account_name = var.hub_storage_account_name
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
Expand Down
2 changes: 1 addition & 1 deletion examples/windows_virtual_machine/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ module "virtual-machine" {
virtual_machine_name = "win-machine"

# (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
hub_storage_account_name = var.hub_storage_account_name

# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
# Defaults to `false`
Expand Down
2 changes: 1 addition & 1 deletion examples/windows_virtual_machine/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "log_analytics_workspace_name" {
default = null
}

variable "hub_storage_account_name" {
variable "storage_account_name" {
description = "The name of the hub storage account to store logs"
default = null
}
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ data "azurerm_log_analytics_workspace" "logws" {
}

data "azurerm_storage_account" "storeacc" {
count = var.hub_storage_account_name != null ? 1 : 0
name = var.hub_storage_account_name
count = var.storage_account_name != null ? 1 : 0
name = var.storage_account_name
resource_group_name = data.azurerm_resource_group.rg.name
}

Expand Down Expand Up @@ -292,10 +292,10 @@ resource "azurerm_virtual_machine_extension" "omsagentlinux" {
# azurerm monitoring diagnostics
#--------------------------------------
resource "azurerm_monitor_diagnostic_setting" "nsg" {
count = var.log_analytics_workspace_name != null && var.hub_storage_account_name != null ? 1 : 0
count = var.log_analytics_workspace_name != null || var.storage_account_name != null ? 1 : 0
name = lower("nsg-${var.virtual_machine_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" {
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ variable "log_analytics_workspace_name" {
default = null
}

variable "hub_storage_account_name" {
variable "storage_account_name" {
description = "The name of the hub storage account to store logs"
default = null
}
Expand Down

0 comments on commit 0b08c0f

Please sign in to comment.