Skip to content

Commit 19d5698

Browse files
committed
updating the documentation #2
1 parent d40309e commit 19d5698

File tree

3 files changed

+76
-249
lines changed

3 files changed

+76
-249
lines changed

examples/README.md

Lines changed: 3 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -4,189 +4,10 @@ Azure virtual machine scale sets let you create and manage a group of identical,
44

55
This module deploys Windows or Linux virtual machine scale sets with Public / Private Load Balancer support and many other features.
66

7-
## Module Usage
7+
## Module Usage for
88

9-
### Linux Virtual Machines Scale Sets
10-
11-
Following example creates Linux virtual machine scale sets with load balancer and auto scaling features.
12-
13-
```hcl
14-
# Azurerm provider configuration
15-
provider "azurerm" {
16-
features {}
17-
}
18-
19-
module "vmscaleset" {
20-
source = "kumarvna/vm-scale-sets/azurerm"
21-
version = "2.2.0"
22-
23-
# Resource Group and location, VNet and Subnet detials (Required)
24-
resource_group_name = "rg-shared-westeurope-01"
25-
virtual_network_name = "vnet-shared-hub-westeurope-001"
26-
subnet_name = "snet-management"
27-
vmscaleset_name = "testvmss"
28-
29-
# (Optional) To enable Azure Monitoring and install log analytics agents
30-
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
31-
log_analytics_workspace_name = var.log_analytics_workspace_name
32-
33-
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
34-
# Defaults to `false`
35-
deploy_log_analytics_agent = false
36-
37-
# This module support multiple Pre-Defined Linux and Windows Distributions.
38-
# These distributions support the Automatic OS image upgrades in virtual machine scale sets
39-
# Linux images: ubuntu1804, ubuntu1604, centos75, coreos
40-
# Windows Images: windows2012r2dc, windows2016dc, windows2019dc, windows2016dccore
41-
# Specify the RSA key for production workloads and set generate_admin_ssh_key argument to false
42-
# When you use Autoscaling feature, instances_count will become default and minimum instance count.
43-
os_flavor = "linux"
44-
linux_distribution_name = "ubuntu1804"
45-
generate_admin_ssh_key = false
46-
admin_ssh_key_data = "~/.ssh/id_rsa.pub"
47-
instances_count = 2
48-
49-
# Public and private load balancer support for VM scale sets
50-
# Specify health probe port to allow LB to detect the backend endpoint status
51-
# Standard Load Balancer helps load-balance TCP and UDP flows on all ports simultaneously
52-
# Specify the list of ports based on your requirement for Load balanced ports
53-
# for additional data disks, provide the list for required size for the disk.
54-
load_balancer_type = "public"
55-
load_balancer_health_probe_port = 80
56-
load_balanced_port_list = [80, 443]
57-
additional_data_disks = [100, 200]
58-
59-
# Enable Auto scaling feature for VM scaleset by set argument to true.
60-
# Instances_count in VMSS will become default and minimum instance count.
61-
# Automatically scale out the number of VM instances based on CPU Average only.
62-
enable_autoscale_for_vmss = true
63-
minimum_instances_count = 2
64-
maximum_instances_count = 5
65-
scale_out_cpu_percentage_threshold = 80
66-
scale_in_cpu_percentage_threshold = 20
67-
68-
# Network Seurity group port allow definitions for each Virtual Machine
69-
# NSG association to be added automatically for all network interfaces.
70-
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
71-
# For production environments, we recommend using a VPN or private connection
72-
nsg_inbound_rules = [
73-
{
74-
name = "http"
75-
destination_port_range = "80"
76-
source_address_prefix = "*"
77-
},
78-
79-
{
80-
name = "https"
81-
destination_port_range = "443"
82-
source_address_prefix = "*"
83-
},
84-
]
85-
86-
# Adding TAG's to your Azure resources (Required)
87-
# ProjectName and Env are already declared above, to use them here, create a varible.
88-
tags = {
89-
ProjectName = "demo-internal"
90-
Env = "dev"
91-
92-
BusinessUnit = "CORP"
93-
ServiceClass = "Gold"
94-
}
95-
}
96-
```
97-
98-
### Windows Virtual Machines Scale Sets
99-
100-
Following example creates Windows virtual machine scale sets with load balancer and auto scaling features.
101-
102-
```hcl
103-
# Azurerm provider configuration
104-
provider "azurerm" {
105-
features {}
106-
}
107-
108-
module "vmscaleset" {
109-
source = "kumarvna/vm-scale-sets/azurerm"
110-
version = "2.2.0"
111-
112-
# Resource Group and location, VNet and Subnet detials (Required)
113-
resource_group_name = "rg-shared-westeurope-01"
114-
virtual_network_name = "vnet-shared-hub-westeurope-001"
115-
subnet_name = "snet-appgateway"
116-
vmscaleset_name = "testvmss"
117-
vm_computer_name = "websrv1"
118-
119-
# (Optional) To enable Azure Monitoring and install log analytics agents
120-
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
121-
log_analytics_workspace_name = var.log_analytics_workspace_name
122-
123-
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
124-
# Defaults to `false`
125-
deploy_log_analytics_agent = false
126-
127-
# This module support multiple Pre-Defined Linux and Windows Distributions.
128-
# These distributions support the Automatic OS image upgrades in virtual machine scale sets
129-
# Linux images: ubuntu1804, ubuntu1604, centos75, coreos
130-
# Windows Images: windows2012r2dc, windows2016dc, windows2019dc, windows2016dccore
131-
# Specify the RSA key for production workloads and set generate_admin_ssh_key argument to false
132-
# When you use Autoscaling feature, instances_count will become default and minimum instance count.
133-
os_flavor = "windows"
134-
windows_distribution_name = "windows2019dc"
135-
instances_count = 2
136-
admin_username = "azureadmin"
137-
admin_password = "P@$$w0rd1234!"
138-
139-
# Public and private load balancer support for VM scale sets
140-
# Specify health probe port to allow LB to detect the backend endpoint status
141-
# Standard Load Balancer helps load-balance TCP and UDP flows on all ports simultaneously
142-
# Specify the list of ports based on your requirement for Load balanced ports
143-
# for additional data disks, provide the list for required size for the disk.
144-
load_balancer_type = "public"
145-
load_balancer_health_probe_port = 80
146-
load_balanced_port_list = [80, 443]
147-
additional_data_disks = [100, 200]
148-
149-
# Enable Auto scaling feature for VM scaleset by set argument to true.
150-
# Instances_count in VMSS will become default and minimum instance count.
151-
# Automatically scale out the number of VM instances based on CPU Average only.
152-
enable_autoscale_for_vmss = true
153-
minimum_instances_count = 2
154-
maximum_instances_count = 5
155-
scale_out_cpu_percentage_threshold = 80
156-
scale_in_cpu_percentage_threshold = 20
157-
158-
# Deploy IIS server minimal installation on VMMS instances
159-
intall_iis_server_on_instances = false
160-
161-
# Network Seurity group port allow definitions for each Virtual Machine
162-
# NSG association to be added automatically for all network interfaces.
163-
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
164-
# For production environments, we recommend using a VPN or private connection
165-
nsg_inbound_rules = [
166-
{
167-
name = "http"
168-
destination_port_range = "80"
169-
source_address_prefix = "*"
170-
},
171-
172-
{
173-
name = "https"
174-
destination_port_range = "443"
175-
source_address_prefix = "*"
176-
},
177-
]
178-
179-
# Adding TAG's to your Azure resources (Required)
180-
# ProjectName and Env are already declared above, to use them here, create a varible.
181-
tags = {
182-
ProjectName = "demo-internal"
183-
Env = "dev"
184-
185-
BusinessUnit = "CORP"
186-
ServiceClass = "Gold"
187-
}
188-
}
189-
```
9+
* [Linux Virtual Machine Scale Set](linux_vm_scale_sets/)
10+
* [Windows Virtual Machine Scale Set](windows_vm_scale_sets/)
19011

19112
## Terraform Usage
19213

examples/windows_vm_scale_sets/README.md

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,45 @@ This module deploys Windows or Linux virtual machine scale sets with Public / Pr
44

55
## Module Usage
66

7-
```hcl
7+
```terraform
88
# Azurerm provider configuration
99
provider "azurerm" {
1010
features {}
1111
}
1212
13+
data "azurerm_log_analytics_workspace" "example" {
14+
name = "loganalytics-we-sharedtest2"
15+
resource_group_name = "rg-shared-westeurope-01"
16+
}
17+
1318
module "vmscaleset" {
1419
source = "kumarvna/vm-scale-sets/azurerm"
15-
version = "2.2.0"
20+
version = "2.3.0"
1621
1722
# Resource Group and location, VNet and Subnet detials (Required)
1823
resource_group_name = "rg-shared-westeurope-01"
1924
virtual_network_name = "vnet-shared-hub-westeurope-001"
2025
subnet_name = "snet-appgateway"
2126
vmscaleset_name = "testvmss"
22-
vm_computer_name = "websrv1"
23-
24-
# (Optional) To enable Azure Monitoring and install log analytics agents
25-
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
26-
log_analytics_workspace_name = var.log_analytics_workspace_name
27-
28-
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
29-
# Defaults to `false`
30-
deploy_log_analytics_agent = false
3127
3228
# This module support multiple Pre-Defined Linux and Windows Distributions.
33-
# These distributions support the Automatic OS image upgrades in virtual machine scale sets
34-
# Linux images: ubuntu1804, ubuntu1604, centos75, coreos
35-
# Windows Images: windows2012r2dc, windows2016dc, windows2019dc, windows2016dccore
36-
# Specify the RSA key for production workloads and set generate_admin_ssh_key argument to false
37-
# When you use Autoscaling feature, instances_count will become default and minimum instance count.
29+
# Check the README.md file for more pre-defined images for Ubuntu, Centos, RedHat.
30+
# Please make sure to use gen2 images supported VM sizes if you use gen2 distributions
31+
# Specify a valid password with `admin_password` argument to use your own password
32+
# If `admin_password` argument is not added, this module creates a random admin password
3833
os_flavor = "windows"
3934
windows_distribution_name = "windows2019dc"
40-
instances_count = 2
35+
virtual_machine_size = "Standard_A2_v2"
4136
admin_username = "azureadmin"
4237
admin_password = "P@$$w0rd1234!"
38+
instances_count = 2
39+
40+
# Proxymity placement group, Automatic Instance repair and adding Public IP to VM's are optional.
41+
# remove these argument from module if you dont want to use it.
42+
enable_proximity_placement_group = true
43+
assign_public_ip_to_each_vm_in_vmss = true
44+
enable_automatic_instance_repair = true
45+
intall_iis_server_on_instances = true
4346
4447
# Public and private load balancer support for VM scale sets
4548
# Specify health probe port to allow LB to detect the backend endpoint status
@@ -60,13 +63,14 @@ module "vmscaleset" {
6063
scale_out_cpu_percentage_threshold = 80
6164
scale_in_cpu_percentage_threshold = 20
6265
63-
# Deploy IIS server minimal installation on VMMS instances
64-
intall_iis_server_on_instances = false
66+
# Boot diagnostics to troubleshoot virtual machines, by default uses managed
67+
# To use custom storage account, specify `storage_account_name` with a valid name
68+
# Passing a `null` value will utilize a Managed Storage Account to store Boot Diagnostics
69+
enable_boot_diagnostics = true
6570
6671
# Network Seurity group port allow definitions for each Virtual Machine
6772
# NSG association to be added automatically for all network interfaces.
68-
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
69-
# For production environments, we recommend using a VPN or private connection
73+
# Remove this NSG rules block, if `existing_network_security_group_id` is specified
7074
nsg_inbound_rules = [
7175
{
7276
name = "http"
@@ -81,10 +85,19 @@ module "vmscaleset" {
8185
},
8286
]
8387
84-
# Adding TAG's to your Azure resources (Required)
85-
# ProjectName and Env are already declared above, to use them here, create a varible.
88+
# (Optional) To enable Azure Monitoring and install log analytics agents
89+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
90+
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.example.id
91+
92+
# Deploy log analytics agents to virtual machine.
93+
# Log analytics workspace customer id and primary shared key required.
94+
deploy_log_analytics_agent = true
95+
log_analytics_customer_id = data.azurerm_log_analytics_workspace.example.workspace_id
96+
log_analytics_workspace_primary_shared_key = data.azurerm_log_analytics_workspace.example.primary_shared_key
97+
98+
# Adding additional TAG's to your Azure resources
8699
tags = {
87-
ProjectName = "demo-internal"
100+
ProjectName = "demo-project"
88101
Env = "dev"
89102
90103
BusinessUnit = "CORP"
@@ -104,23 +117,3 @@ terraform apply
104117
```
105118

106119
Run `terraform destroy` when you don't need these resources.
107-
108-
## Outputs
109-
110-
|Name | Description|
111-
|---- | -----------|
112-
`admin_ssh_key_public`|The generated public key data in PEM format
113-
`admin_ssh_key_private`|The generated private key data in PEM format
114-
`windows_vm_password`|Password for the windows Virtual Machine
115-
`load_balancer_public_ip`|The Public IP address allocated for load balancer
116-
`load_balancer_private_ip`|The Private IP address allocated for load balancer
117-
`load_balancer_nat_pool_id`|The resource ID of the Load Balancer NAT pool
118-
`load_balancer_health_probe_id`|The resource ID of the Load Balancer health Probe
119-
`load_balancer_rules_id`|The resource ID of the Load Balancer Rule
120-
`network_security_group_id`|The resource id of Network security group
121-
`linux_virtual_machine_scale_set_name`|The name of the Linux Virtual Machine Scale Set
122-
`linux_virtual_machine_scale_set_id`|The resource ID of the Linux Virtual Machine Scale Set
123-
`linux_virtual_machine_scale_set_unique_id`|The unique ID of the Linux Virtual Machine Scale Set
124-
`windows_virtual_machine_scale_set_name`|The name of the windows Virtual Machine Scale Set
125-
`windows_virtual_machine_scale_set_id`|The resource ID of the windows Virtual Machine Scale Set
126-
`windows_virtual_machine_scale_set_unique_id`|The unique ID of the windows Virtual Machine Scale Set

0 commit comments

Comments
 (0)