Skip to content

Commit 1609b40

Browse files
committed
module update
1 parent e95567e commit 1609b40

File tree

7 files changed

+67
-47
lines changed

7 files changed

+67
-47
lines changed

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module "vmscaleset" {
3030
3131
# (Optional) To enable Azure Monitoring and install log analytics agents
3232
log_analytics_workspace_name = var.log_analytics_workspace_name
33-
hub_storage_account_name = var.hub_storage_account_name
33+
storage_account_name = var. storage_account_name
3434
3535
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
3636
# Defaults to `false`
@@ -123,7 +123,7 @@ If the pre-defined Windows or Linux variants are not sufficient then, you can sp
123123
```hcl
124124
module "vmscaleset" {
125125
source = "kumarvna/vm-scale-sets/azurerm"
126-
version = "2.0.0"
126+
version = "2.1.0"
127127
128128
# .... omitted
129129
@@ -236,7 +236,7 @@ In the Source and Destination columns, `VirtualNetwork`, `AzureLoadBalancer`, an
236236
```hcl
237237
module "vmscaleset" {
238238
source = "kumarvna/vm-scale-sets/azurerm"
239-
version = "2.0.0"
239+
version = "2.1.0"
240240
241241
# .... omitted
242242
@@ -296,7 +296,7 @@ End Date of the Project|Date when this application, workload, or service is plan
296296
```hcl
297297
module "vmscaleset" {
298298
source = "kumarvna/vm-scale-sets/azurerm"
299-
version = "2.0.0"
299+
version = "2.1.0"
300300
301301
# Resource Group, location, VNet and Subnet details
302302
resource_group_name = "rg-hub-tieto-internal-shared-westeurope-001"
@@ -318,13 +318,13 @@ module "vmscaleset" {
318318
Name | Version
319319
-----|--------
320320
terraform | >= 0.13
321-
azurerm | ~> 2.27.0
321+
azurerm | >= 2.59.0
322322

323323
## Providers
324324

325325
| Name | Version |
326326
|------|---------|
327-
azurerm | 2.27.0
327+
azurerm | 2.59.0
328328
random | n/a
329329
tls | n/a
330330

@@ -338,9 +338,12 @@ Name | Description | Type | Default
338338
`subnet_name`|The name of the subnet to use in VM scale set|string |`""`
339339
`vmscaleset_name`|Specifies the name of the virtual machine scale set resource|string | `""`
340340
`log_analytics_workspace_name`|The name of log analytics workspace name|string | `""`
341-
`hub_storage_account_name`|The name of the hub storage account to store logs|string | `""`
341+
`storage_account_name`|The name of the hub storage account to store logs|string | `""`
342+
`enable_load_balancer`|Controls if public load balancer should be created|sting|`true`
342343
`load_balancer_sku`|The SKU of the Azure Load Balancer. Accepted values are `Basic` and `Standard`|string | `"Standard"`
343344
`load_balancer_type`|Controls the type of load balancer should be created. Possible values are `public` and `private`|string | `"private"`
345+
`public_ip_allocation_method`|Defines the allocation method for this IP address. Possible values are `Static` or `Dynamic`|string|`Static`
346+
`public_ip_sku`|The SKU of the Public IP. Accepted values are `Basic` and `Standard`|string|`Standard`
344347
`enable_lb_nat_pool`|If enabled load balancer NAT pool will be created for SSH if flavor is Linux and for RDP if flavor is windows|string|`false`
345348
`nat_pool_frontend_ports`|Optional override for default NAT ports|list(number)|`[50000, 50119]`
346349
`os_flavor`|Specify the flavor of the operating system image to deploy Virtual Machine. Possible values are `windows` and `linux`|string |`"windows"`
@@ -367,6 +370,7 @@ Name | Description | Type | Default
367370
`disable_password_authentication`|Should Password Authentication be disabled on this Virtual Machine. Applicable to Linux Virtual machine|string|`true`
368371
`admin_username`|The username of the local administrator used for the Virtual Machine|string|`"azureadmin"`
369372
`admin_password`|The Password which should be used for the local-administrator on the Virtual Machines|string|`null`
373+
`random_password_length`|The desired length of random password created by this module|number|`24`
370374
`private_ip_address_allocation_type`|The allocation method used for the Private IP Address. Possible values are Dynamic and Static.|string|`false`
371375
`lb_private_ip_address`|The Static Private IP Address to assign to the Load Balancer. This is valid only when `private_ip_address_allocation` is set to `Static`.|string|`null`
372376
`enable_ip_forwarding`|Should IP Forwarding be enabled?|string|`false`
@@ -380,6 +384,9 @@ Name | Description | Type | Default
380384
`scale_out_cpu_percentage_threshold`|Specifies the threshold % of the metric that triggers the scale out action.|number|80
381385
`scale_in_cpu_percentage_threshold`|Specifies the threshold % of the metric that triggers the scale in action.|number|20
382386
`scaling_action_instances_number`|The number of instances involved in the scaling action|number|`1`
387+
`intall_iis_server_on_instances`|Install ISS server on every Instance in the VM scale set|string|`false`
388+
`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`
389+
`deploy_log_analytics_agent`|Install log analytics agent to windows or linux VM scaleset instances|string|`false`
383390
`Tags`|A map of tags to add to all resources|map|`{}`
384391

385392
## Outputs

examples/README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,25 +97,29 @@ Following example creates Windows virtual machine scale sets with load balancer
9797
```hcl
9898
module "vmscaleset" {
9999
source = "kumarvna/vm-scale-sets/azurerm"
100-
version = "2.0.0"
100+
version = "2.1.0"
101101
102102
# Resource Group and location, VNet and Subnet detials (Required)
103-
resource_group_name = "rg-demo-westeurope-01" #"rg-hub-demo-internal-shared-westeurope-001"
104-
virtual_network_name = "vnet-demo-westeurope-001"
105-
subnet_name = "appgateway"
103+
resource_group_name = "rg-shared-westeurope-01"
104+
virtual_network_name = "vnet-shared-hub-westeurope-001"
105+
subnet_name = "snet-appgateway"
106106
vmscaleset_name = "testvmss"
107107
vm_computer_name = "websrv1"
108108
109109
# (Optional) To enable Azure Monitoring and install log analytics agents
110-
log_analytics_workspace_name = var.log_analytics_workspace_id
111-
hub_storage_account_name = var.hub_storage_account_id
110+
log_analytics_workspace_name = var.log_analytics_workspace_name
111+
hub_storage_account_name = var.hub_storage_account_name
112+
113+
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
114+
# Defaults to `false`
115+
deploy_log_analytics_agent = false
112116
113117
# This module support multiple Pre-Defined Linux and Windows Distributions.
114118
# These distributions support the Automatic OS image upgrades in virtual machine scale sets
115119
# Linux images: ubuntu1804, ubuntu1604, centos75, coreos
116120
# Windows Images: windows2012r2dc, windows2016dc, windows2019dc, windows2016dccore
117121
# Specify the RSA key for production workloads and set generate_admin_ssh_key argument to false
118-
# When you use Autoscaling feature, instances_count will become default and minimum instance count.
122+
# When you use Autoscaling feature, instances_count will become default and minimum instance count.
119123
os_flavor = "windows"
120124
windows_distribution_name = "windows2019dc"
121125
instances_count = 2
@@ -126,24 +130,27 @@ module "vmscaleset" {
126130
# Specify health probe port to allow LB to detect the backend endpoint status
127131
# Standard Load Balancer helps load-balance TCP and UDP flows on all ports simultaneously
128132
# Specify the list of ports based on your requirement for Load balanced ports
129-
# for additional data disks, provide the list for required size for the disk.
133+
# for additional data disks, provide the list for required size for the disk.
130134
load_balancer_type = "public"
131135
load_balancer_health_probe_port = 80
132136
load_balanced_port_list = [80, 443]
133137
additional_data_disks = [100, 200]
134138
135-
# Enable Auto scaling feature for VM scaleset by set argument to true.
139+
# Enable Auto scaling feature for VM scaleset by set argument to true.
136140
# Instances_count in VMSS will become default and minimum instance count.
137-
# Automatically scale out the number of VM instances based on CPU Average only.
141+
# Automatically scale out the number of VM instances based on CPU Average only.
138142
enable_autoscale_for_vmss = true
139143
minimum_instances_count = 2
140144
maximum_instances_count = 5
141145
scale_out_cpu_percentage_threshold = 80
142146
scale_in_cpu_percentage_threshold = 20
143147
148+
# Deploy IIS server minimal installation on VMMS instances
149+
intall_iis_server_on_instances = false
150+
144151
# Network Seurity group port allow definitions for each Virtual Machine
145152
# NSG association to be added automatically for all network interfaces.
146-
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
153+
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
147154
# For production environments, we recommend using a VPN or private connection
148155
nsg_inbound_rules = [
149156
{
@@ -160,7 +167,7 @@ module "vmscaleset" {
160167
]
161168
162169
# Adding TAG's to your Azure resources (Required)
163-
# ProjectName and Env are already declared above, to use them here, create a varible.
170+
# ProjectName and Env are already declared above, to use them here, create a varible.
164171
tags = {
165172
ProjectName = "demo-internal"
166173
Env = "dev"

examples/windows_vm_scale_sets/README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,29 @@ This module deploys Windows or Linux virtual machine scale sets with Public / Pr
77
```hcl
88
module "vmscaleset" {
99
source = "kumarvna/vm-scale-sets/azurerm"
10-
version = "2.0.0"
10+
version = "2.1.0"
1111
1212
# Resource Group and location, VNet and Subnet detials (Required)
13-
resource_group_name = "rg-demo-westeurope-01" #"rg-hub-demo-internal-shared-westeurope-001"
14-
virtual_network_name = "vnet-demo-westeurope-001"
15-
subnet_name = "appgateway"
13+
resource_group_name = "rg-shared-westeurope-01"
14+
virtual_network_name = "vnet-shared-hub-westeurope-001"
15+
subnet_name = "snet-appgateway"
1616
vmscaleset_name = "testvmss"
1717
vm_computer_name = "websrv1"
1818
1919
# (Optional) To enable Azure Monitoring and install log analytics agents
20-
log_analytics_workspace_name = var.log_analytics_workspace_id
21-
hub_storage_account_name = var.hub_storage_account_id
20+
log_analytics_workspace_name = var.log_analytics_workspace_name
21+
hub_storage_account_name = var.hub_storage_account_name
22+
23+
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
24+
# Defaults to `false`
25+
deploy_log_analytics_agent = false
2226
2327
# This module support multiple Pre-Defined Linux and Windows Distributions.
2428
# These distributions support the Automatic OS image upgrades in virtual machine scale sets
2529
# Linux images: ubuntu1804, ubuntu1604, centos75, coreos
2630
# Windows Images: windows2012r2dc, windows2016dc, windows2019dc, windows2016dccore
2731
# Specify the RSA key for production workloads and set generate_admin_ssh_key argument to false
28-
# When you use Autoscaling feature, instances_count will become default and minimum instance count.
32+
# When you use Autoscaling feature, instances_count will become default and minimum instance count.
2933
os_flavor = "windows"
3034
windows_distribution_name = "windows2019dc"
3135
instances_count = 2
@@ -36,24 +40,27 @@ module "vmscaleset" {
3640
# Specify health probe port to allow LB to detect the backend endpoint status
3741
# Standard Load Balancer helps load-balance TCP and UDP flows on all ports simultaneously
3842
# Specify the list of ports based on your requirement for Load balanced ports
39-
# for additional data disks, provide the list for required size for the disk.
43+
# for additional data disks, provide the list for required size for the disk.
4044
load_balancer_type = "public"
4145
load_balancer_health_probe_port = 80
4246
load_balanced_port_list = [80, 443]
4347
additional_data_disks = [100, 200]
4448
45-
# Enable Auto scaling feature for VM scaleset by set argument to true.
49+
# Enable Auto scaling feature for VM scaleset by set argument to true.
4650
# Instances_count in VMSS will become default and minimum instance count.
47-
# Automatically scale out the number of VM instances based on CPU Average only.
51+
# Automatically scale out the number of VM instances based on CPU Average only.
4852
enable_autoscale_for_vmss = true
4953
minimum_instances_count = 2
5054
maximum_instances_count = 5
5155
scale_out_cpu_percentage_threshold = 80
5256
scale_in_cpu_percentage_threshold = 20
5357
58+
# Deploy IIS server minimal installation on VMMS instances
59+
intall_iis_server_on_instances = false
60+
5461
# Network Seurity group port allow definitions for each Virtual Machine
5562
# NSG association to be added automatically for all network interfaces.
56-
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
63+
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
5764
# For production environments, we recommend using a VPN or private connection
5865
nsg_inbound_rules = [
5966
{
@@ -70,7 +77,7 @@ module "vmscaleset" {
7077
]
7178
7279
# Adding TAG's to your Azure resources (Required)
73-
# ProjectName and Env are already declared above, to use them here, create a varible.
80+
# ProjectName and Env are already declared above, to use them here, create a varible.
7481
tags = {
7582
ProjectName = "demo-internal"
7683
Env = "dev"

examples/windows_vm_scale_sets/main.tf

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module "vmscaleset" {
2-
//source = "kumarvna/vm-scale-sets/azurerm"
3-
//version = "2.0.0"
4-
source = "github.com/kumarvna/terraform-azurerm-vm-scale-sets?ref=develop"
2+
source = "kumarvna/vm-scale-sets/azurerm"
3+
version = "2.1.0"
54

65
# Resource Group and location, VNet and Subnet detials (Required)
76
resource_group_name = "rg-shared-westeurope-01"
@@ -11,12 +10,12 @@ module "vmscaleset" {
1110
vm_computer_name = "websrv1"
1211

1312
# (Optional) To enable Azure Monitoring and install log analytics agents
14-
log_analytics_workspace_name = "loganalytics-we-sharedtest2" #var.log_analytics_workspace_name
15-
hub_storage_account_name = "stdiagfortesting" #var.hub_storage_account_name
13+
log_analytics_workspace_name = var.log_analytics_workspace_name
14+
hub_storage_account_name = var.hub_storage_account_name
1615

1716
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
1817
# Defaults to `false`
19-
deploy_log_analytics_agent = true
18+
deploy_log_analytics_agent = false
2019

2120
# This module support multiple Pre-Defined Linux and Windows Distributions.
2221
# These distributions support the Automatic OS image upgrades in virtual machine scale sets
@@ -28,7 +27,7 @@ module "vmscaleset" {
2827
windows_distribution_name = "windows2019dc"
2928
instances_count = 2
3029
admin_username = "azureadmin"
31-
#admin_password = "P@$$w0rd1234!"
30+
admin_password = "P@$$w0rd1234!"
3231

3332
# Public and private load balancer support for VM scale sets
3433
# Specify health probe port to allow LB to detect the backend endpoint status
@@ -50,7 +49,7 @@ module "vmscaleset" {
5049
scale_in_cpu_percentage_threshold = 20
5150

5251
# Deploy IIS server minimal installation on VMMS instances
53-
intall_iis_server_on_instances = true
52+
intall_iis_server_on_instances = false
5453

5554
# Network Seurity group port allow definitions for each Virtual Machine
5655
# NSG association to be added automatically for all network interfaces.

graph.png

-784 KB
Binary file not shown.

main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ data "azurerm_log_analytics_workspace" "logws" {
4343
}
4444

4545
data "azurerm_storage_account" "storeacc" {
46-
count = var.hub_storage_account_name != null ? 1 : 0
47-
name = var.hub_storage_account_name
46+
count = var.storage_account_name != null ? 1 : 0
47+
name = var.storage_account_name
4848
resource_group_name = data.azurerm_resource_group.rg.name
4949
}
5050

@@ -481,7 +481,7 @@ resource "azurerm_virtual_machine_scale_set_extension" "omsagentlinux" {
481481
# azurerm monitoring diagnostics
482482
#--------------------------------------
483483
resource "azurerm_monitor_diagnostic_setting" "vmmsdiag" {
484-
count = var.log_analytics_workspace_name != null && var.hub_storage_account_name != null ? 1 : 0
484+
count = var.log_analytics_workspace_name != null && var.storage_account_name != null ? 1 : 0
485485
name = lower("${var.vmscaleset_name}-diag")
486486
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
487487
storage_account_id = data.azurerm_storage_account.storeacc.0.id
@@ -497,7 +497,7 @@ resource "azurerm_monitor_diagnostic_setting" "vmmsdiag" {
497497
}
498498

499499
resource "azurerm_monitor_diagnostic_setting" "nsg" {
500-
count = var.log_analytics_workspace_name != null && var.hub_storage_account_name != null ? 1 : 0
500+
count = var.log_analytics_workspace_name != null && var.storage_account_name != null ? 1 : 0
501501
name = lower("nsg-${var.vmscaleset_name}-diag")
502502
target_resource_id = azurerm_network_security_group.nsg.id
503503
storage_account_id = data.azurerm_storage_account.storeacc.0.id
@@ -517,7 +517,7 @@ resource "azurerm_monitor_diagnostic_setting" "nsg" {
517517
}
518518

519519
resource "azurerm_monitor_diagnostic_setting" "lb-pip" {
520-
count = var.load_balancer_type == "public" && var.log_analytics_workspace_name != null && var.hub_storage_account_name != null ? 1 : 0
520+
count = var.load_balancer_type == "public" && var.log_analytics_workspace_name != null && var.storage_account_name != null ? 1 : 0
521521
name = "${var.vmscaleset_name}-pip-diag"
522522
target_resource_id = azurerm_public_ip.pip.0.id
523523
storage_account_id = data.azurerm_storage_account.storeacc.0.id
@@ -545,7 +545,7 @@ resource "azurerm_monitor_diagnostic_setting" "lb-pip" {
545545
}
546546

547547
resource "azurerm_monitor_diagnostic_setting" "lb" {
548-
count = var.load_balancer_type == "public" && var.log_analytics_workspace_name != null && var.hub_storage_account_name != null ? 1 : 0
548+
count = var.load_balancer_type == "public" && var.log_analytics_workspace_name != null && var.storage_account_name != null ? 1 : 0
549549
name = "${var.vmscaleset_name}-lb-diag"
550550
target_resource_id = azurerm_lb.vmsslb.0.id
551551
storage_account_id = data.azurerm_storage_account.storeacc.0.id

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ variable "log_analytics_workspace_name" {
2828
default = null
2929
}
3030

31-
variable "hub_storage_account_name" {
31+
variable "storage_account_name" {
3232
description = "The name of the hub storage account to store logs"
3333
default = null
3434
}
@@ -383,7 +383,7 @@ variable "vm_time_zone" {
383383
}
384384

385385
variable "deploy_log_analytics_agent" {
386-
description = "Install log analytics agent to windows or linux VM"
386+
description = "Install log analytics agent to windows or linux VM scaleset instances"
387387
default = false
388388
}
389389

0 commit comments

Comments
 (0)