Skip to content

Commit d40309e

Browse files
committed
updating the documentation #1
1 parent 298e2b3 commit d40309e

File tree

2 files changed

+79
-63
lines changed

2 files changed

+79
-63
lines changed

examples/linux_vm_scale_sets/README.md

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,47 @@ 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-management"
2126
vmscaleset_name = "testvmss"
2227
23-
# (Optional) To enable Azure Monitoring and install log analytics agents
24-
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
25-
log_analytics_workspace_name = var.log_analytics_workspace_name
26-
27-
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
28-
# Defaults to `false`
29-
deploy_log_analytics_agent = false
30-
3128
# This module support multiple Pre-Defined Linux and Windows Distributions.
32-
# These distributions support the Automatic OS image upgrades in virtual machine scale sets
33-
# Linux images: ubuntu1804, ubuntu1604, centos75, coreos
34-
# Windows Images: windows2012r2dc, windows2016dc, windows2019dc, windows2016dccore
35-
# Specify the RSA key for production workloads and set generate_admin_ssh_key argument to false
36-
# 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 `disable_password_authentication = false` to create random admin password
32+
# Specify a valid password with `admin_password` argument to use your own password
33+
# To generate SSH key pair, specify `generate_admin_ssh_key = true`
34+
# To use existing key pair, specify `admin_ssh_key_data` to a valid SSH public key path.
3735
os_flavor = "linux"
3836
linux_distribution_name = "ubuntu1804"
39-
generate_admin_ssh_key = false
40-
admin_ssh_key_data = "~/.ssh/id_rsa.pub"
37+
virtual_machine_size = "Standard_A2_v2"
38+
admin_username = "azureadmin"
39+
generate_admin_ssh_key = true
4140
instances_count = 2
4241
42+
# Proxymity placement group, Automatic Instance repair and adding Public IP to VM's are optional.
43+
# remove these argument from module if you dont want to use it.
44+
enable_proximity_placement_group = true
45+
assign_public_ip_to_each_vm_in_vmss = true
46+
enable_automatic_instance_repair = true
47+
4348
# Public and private load balancer support for VM scale sets
4449
# Specify health probe port to allow LB to detect the backend endpoint status
4550
# Standard Load Balancer helps load-balance TCP and UDP flows on all ports simultaneously
@@ -59,10 +64,14 @@ module "vmscaleset" {
5964
scale_out_cpu_percentage_threshold = 80
6065
scale_in_cpu_percentage_threshold = 20
6166
67+
# Boot diagnostics to troubleshoot virtual machines, by default uses managed
68+
# To use custom storage account, specify `storage_account_name` with a valid name
69+
# Passing a `null` value will utilize a Managed Storage Account to store Boot Diagnostics
70+
enable_boot_diagnostics = true
71+
6272
# Network Seurity group port allow definitions for each Virtual Machine
6373
# NSG association to be added automatically for all network interfaces.
64-
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
65-
# For production environments, we recommend using a VPN or private connection
74+
# Remove this NSG rules block, if `existing_network_security_group_id` is specified
6675
nsg_inbound_rules = [
6776
{
6877
name = "http"
@@ -77,10 +86,19 @@ module "vmscaleset" {
7786
},
7887
]
7988
80-
# Adding TAG's to your Azure resources (Required)
81-
# ProjectName and Env are already declared above, to use them here, create a varible.
89+
# (Optional) To enable Azure Monitoring and install log analytics agents
90+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
91+
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.example.id
92+
93+
# Deploy log analytics agents to virtual machine.
94+
# Log analytics workspace customer id and primary shared key required.
95+
deploy_log_analytics_agent = true
96+
log_analytics_customer_id = data.azurerm_log_analytics_workspace.example.workspace_id
97+
log_analytics_workspace_primary_shared_key = data.azurerm_log_analytics_workspace.example.primary_shared_key
98+
99+
# Adding additional TAG's to your Azure resources
82100
tags = {
83-
ProjectName = "demo-internal"
101+
ProjectName = "demo-project"
84102
Env = "dev"
85103
86104
BusinessUnit = "CORP"
@@ -100,23 +118,3 @@ terraform apply
100118
```
101119

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

examples/linux_vm_scale_sets/main.tf

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,41 @@ provider "azurerm" {
33
features {}
44
}
55

6+
data "azurerm_log_analytics_workspace" "example" {
7+
name = "loganalytics-we-sharedtest2"
8+
resource_group_name = "rg-shared-westeurope-01"
9+
}
10+
611
module "vmscaleset" {
712
source = "kumarvna/vm-scale-sets/azurerm"
8-
version = "2.2.0"
13+
version = "2.3.0"
914

1015
# Resource Group and location, VNet and Subnet detials (Required)
1116
resource_group_name = "rg-shared-westeurope-01"
1217
virtual_network_name = "vnet-shared-hub-westeurope-001"
1318
subnet_name = "snet-management"
1419
vmscaleset_name = "testvmss"
1520

16-
# (Optional) To enable Azure Monitoring and install log analytics agents
17-
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
18-
log_analytics_workspace_name = var.log_analytics_workspace_name
19-
20-
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
21-
# Defaults to `false`
22-
deploy_log_analytics_agent = false
23-
2421
# This module support multiple Pre-Defined Linux and Windows Distributions.
25-
# These distributions support the Automatic OS image upgrades in virtual machine scale sets
26-
# Linux images: ubuntu1804, ubuntu1604, centos75, coreos
27-
# Windows Images: windows2012r2dc, windows2016dc, windows2019dc, windows2016dccore
28-
# Specify the RSA key for production workloads and set generate_admin_ssh_key argument to false
29-
# When you use Autoscaling feature, instances_count will become default and minimum instance count.
22+
# Check the README.md file for more pre-defined images for Ubuntu, Centos, RedHat.
23+
# Please make sure to use gen2 images supported VM sizes if you use gen2 distributions
24+
# Specify `disable_password_authentication = false` to create random admin password
25+
# Specify a valid password with `admin_password` argument to use your own password
26+
# To generate SSH key pair, specify `generate_admin_ssh_key = true`
27+
# To use existing key pair, specify `admin_ssh_key_data` to a valid SSH public key path.
3028
os_flavor = "linux"
3129
linux_distribution_name = "ubuntu1804"
32-
generate_admin_ssh_key = false
33-
admin_ssh_key_data = "~/.ssh/id_rsa.pub"
30+
virtual_machine_size = "Standard_A2_v2"
31+
admin_username = "azureadmin"
32+
generate_admin_ssh_key = true
3433
instances_count = 2
3534

35+
# Proxymity placement group, Automatic Instance repair and adding Public IP to VM's are optional.
36+
# remove these argument from module if you dont want to use it.
37+
enable_proximity_placement_group = true
38+
assign_public_ip_to_each_vm_in_vmss = true
39+
enable_automatic_instance_repair = true
40+
3641
# Public and private load balancer support for VM scale sets
3742
# Specify health probe port to allow LB to detect the backend endpoint status
3843
# Standard Load Balancer helps load-balance TCP and UDP flows on all ports simultaneously
@@ -52,10 +57,14 @@ module "vmscaleset" {
5257
scale_out_cpu_percentage_threshold = 80
5358
scale_in_cpu_percentage_threshold = 20
5459

60+
# Boot diagnostics to troubleshoot virtual machines, by default uses managed
61+
# To use custom storage account, specify `storage_account_name` with a valid name
62+
# Passing a `null` value will utilize a Managed Storage Account to store Boot Diagnostics
63+
enable_boot_diagnostics = true
64+
5565
# Network Seurity group port allow definitions for each Virtual Machine
5666
# NSG association to be added automatically for all network interfaces.
57-
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
58-
# For production environments, we recommend using a VPN or private connection
67+
# Remove this NSG rules block, if `existing_network_security_group_id` is specified
5968
nsg_inbound_rules = [
6069
{
6170
name = "http"
@@ -70,10 +79,19 @@ module "vmscaleset" {
7079
},
7180
]
7281

73-
# Adding TAG's to your Azure resources (Required)
74-
# ProjectName and Env are already declared above, to use them here, create a varible.
82+
# (Optional) To enable Azure Monitoring and install log analytics agents
83+
# (Optional) Specify `storage_account_name` to save monitoring logs to storage.
84+
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.example.id
85+
86+
# Deploy log analytics agents to virtual machine.
87+
# Log analytics workspace customer id and primary shared key required.
88+
deploy_log_analytics_agent = true
89+
log_analytics_customer_id = data.azurerm_log_analytics_workspace.example.workspace_id
90+
log_analytics_workspace_primary_shared_key = data.azurerm_log_analytics_workspace.example.primary_shared_key
91+
92+
# Adding additional TAG's to your Azure resources
7593
tags = {
76-
ProjectName = "demo-internal"
94+
ProjectName = "demo-project"
7795
Env = "dev"
7896
7997
BusinessUnit = "CORP"

0 commit comments

Comments
 (0)